Announcement

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

    Problem with hilites and formula columns

    Hi,

    If I create a formula and then use that formula as part of a Hilite rule, it doesn't seem to work properly. Here is an example using the following from Feature Explorer.

    http://www.smartclient.com/docs/8.2/a/system/reference/SmartClient_Explorer.html#formulaHilites


    Use the code below and create a formula column with the function testFunction(record). That will put a 10 in the US column and a 20 in every other column. Then, Edit Hilites and create a Hilite where this new formula column must be greater than 10 to apply the Hilite. You'll see that all rows get the Hilite formatting, even the US record that is not greater than 10.



    Code:
    var ds = isc.DataSource.get("countryDS");
    
    isc.VLayout.create({
    	ID:"layout",
    	width:500, height:250,
    	members: [
    		isc.HLayout.create({
    			ID:"buttonLayout",
    			width:"*", height:30,
    			membersMargin: 10,
    			members: [
    				isc.IButton.create({
    				    ID: "formulaButton",
    				    autoFit: true,
    				    title: "Show Formula Builder",
    				    click: "countryList.addFormulaField();"
    				}),
    				isc.IButton.create({
    				    ID: "editHilitesButton",
    				    autoFit: true,
    				    title: "Edit Hilites",
    				    click: "countryList.editHilites();"
    				}),
    				isc.IButton.create({
    				    ID: "stateButton",
    				    autoFit: true,
    				    title: "Recreate from State",
    				    click: function () {
    				        var fieldState = countryList.getFieldState(true),
                                hiliteState = countryList.getHiliteState();
    
    						countryList.destroy();
    						recreateListGrid();
    				        countryList.setFieldState(fieldState);
    				        countryList.setHiliteState(hiliteState);
    				    }
    				})
    			]
    		})
    	]
    });
    
    recreateListGrid();
    
    function recreateListGrid() {
    	layout.addMember(isc.ListGrid.create({
    	    ID: "countryList",
    	    width:"100%", height:"*",
    	    alternateRecordStyles:true, cellHeight:22,
    	    dataSource: ds,
    	    autoFetchData: true,
               showGridSummary:true,
    	    canAddFormulaFields: true,
    	    canAddSummaryFields: true,
    	    fields:[
    	        {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", 
    	            imageURLSuffix:".png"
    	        },
    	        {name:"countryName", title:"Country"},
    	        {name:"capital", title:"Capital"},
    	        {name:"population", title:"Population", formatCellValue:"isc.Format.toUSString(value)"},
    	        {name:"area", title:"Area (km²)", formatCellValue:"isc.Format.toUSString(value)"},
    	        {name:"gdp", formatCellValue:"isc.Format.toUSString(value)"}
    	    ]
    	}));
    
    }
    
    var testFunction={jsFunction:function(record){if(record.countryName=='United States'){return 10;}else{return 20;}},name:"testFunction",description:"testFunction"};
    isc.MathFunction.registerFunction(testFunction);
    var testFunction2={jsFunction:function(record){return 10},name:"testFunction2",description:"testFunction2"};
    isc.MathFunction.registerFunction(testFunction2);

    #2
    We see the problem and it was caused by some fixes to address issues with filtering on fields that don't exist in the DataSource. Should have a correction within a couple of days.

    Comment


      #3
      We've made a fix for this which should be in the nightly builds for SC 8.2p/8.3d shortly.

      Comment


        #4
        Thank you, looks good

        Comment

        Working...
        X