Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Customized DynamicForm Issue

    Hi,

    We got an error while creating the customized DynamicForm. The issue happens on SmartClient_v91p_2014-09-16_PowerEdition. On SmartClient_v91p_2014-04-08_PowerEdition it works fine. We notice the issue happens while evaluating "if(_1[i].hasAdvancedCriteria())" in function "isc_DynamicForm_removeItems(_1)"

    Please try the following standalone. Thanks!

    Code:
    isc.ClassFactory.defineClass("CwDynamicFormExtend", "DynamicForm");
    
    isc.CwDynamicFormExtend.addProperties({
    	setItems: function(itemList){
    		if(this.$cwCellBorderStyle!=null){
    			var i = 0;
    			var length = itemList.length;			
    			for(i=0;i<length;i++){
    				var currentField =  itemList.get(i);
    				var currentCellStyle = currentField.cellStyle;
    				if(currentCellStyle=="formCell" || currentCellStyle == null){
    					currentField.cellStyle =  this.$cwCellBorderStyle;
    				}
    			}
    		}
    		this.Super("setItems", [itemList]);
    	},
    });
    
    isc.CwDynamicFormExtend.create({width:240,ID:"LoginGrid",name:"LoginGrid",showErrorStyle:false,showErrorIcons:true,numCols:2,colWidths:["90","150"],titleOrientation:"left",margin:0,fields:[{title:"TF",type:"text"}]})

    #2
    Hi
    The problem here is that there's an undocumented extra argument passed to 'setItems' which is required for things to function correctly in an override of this sort.
    A quick fix for this:
    Code:
    ...
    isc.CwDynamicFormExtend.addProperties({
    	setItems : function(itemList, firstInit){
            if(this.$cwCellBorderStyle!=null){
    			var i = 0;
    			var length = itemList.length;			
    			for(i=0;i<length;i++){
    				var currentField =  itemList.get(i);
    				var currentCellStyle = currentField.cellStyle;
    				if(currentCellStyle=="formCell" || currentCellStyle == null){
    					currentField.cellStyle =  this.$cwCellBorderStyle;
    				}
    			}
    		}
            return this.Super("setItems", [itemList, firstInit], arguments);
    	}
    });
    ...
    We agree that this is a gotcha in this case and we'll look at whether there's a way we can avoid similar confusion going forward.

    As an aside - if you call "Super" and you modify the arguments array, you should be passing in the native 'arguments' object as a third parameter. There are some rare edge cases where this is required to make things like observation behave as expected.

    Regards
    Isomorphic Software

    Comment


      #3
      Thanks for the solution! Now it works fine in our product.

      Comment


        #4
        Great - we're making a change to mainline (10.1d branch) which renders this unnecessary in the future, but it won't hurt anything to leave it in place

        Regards
        Isomorphic Software

        Comment

        Working...
        X