Announcement

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

    Problem with Advanced Highlight Rule editing

    Hi,

    We are seeing a problem with editing Advanced Hilighting Rules in 8.2. Not yet tested in 8.3

    Here are steps to recreate. Open the following example:
    http://www.smartclient.com/docs/8.2/a/system/reference/SmartClient_Explorer.html#userDefinedHilites

    Insert this code:
    Code:
    var ds = isc.DataSource.get("countryDS");
    
    isc.VLayout.create({
    	ID:"layout",
    	width:600, height:250,
    	members: [
    		isc.HLayout.create({
    			ID:"buttonLayout",
    			width:"*", height:30,
    			membersMargin: 10,
    			members: [
    				isc.IButton.create({
    				    ID: "editHilitesButton",
    				    autoFit: true,
    				    title: "Edit Hilites",
    				    click: "countryList.editHilites();"
    				}),
    				isc.IButton.create({
    				    ID: "getHilitesButton",
    				    autoFit: true,
    				    title: "Get Hilites",
    				    click: "isc.Log.logInfo(countryList.getHiliteState())"
    				}),
    				isc.IButton.create({
    				    ID: "stateButton",
    				    autoFit: true,
    				    title: "Recreate from State",
    				    click: function () {
    				        var state = countryList.getHiliteState();
    
    						countryList.destroy();
    						recreateListGrid();
    				        countryList.setHiliteState(state);
    				    }
    				})
    			]
    		})
    	]
    });
    
    // create the initial ListGrid
    recreateListGrid();
    
    // function to create a new ListGrid
    function recreateListGrid() {
    	layout.addMember(isc.ListGrid.create({
    	    ID: "countryList",
    	    width:"100%", height:"*",
    	    alternateRecordStyles:true, cellHeight:22,
    	    dataSource: ds,
    	    autoFetchData: true,
    	    canAddFormulaFields: true,
    	    canAddSummaryFields: true,
            useAllDataSourceFields:true,
    	    fields:[
    	        {name:"countryCode", title:"Flag", width:40, type:"image", imageURLPrefix:"flags/16/", 
    	            imageURLSuffix:".png"
    	        },
        
    	        {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)"},
                {name:"capital", hidden:true},
                {name:"government", hidden:true}
    	    ]
    	}));
    
    }
    
    countryList.setHiliteState('([{"fieldName":"independence","criteria":{"_constructor":"AdvancedCriteria","operator":"and","criteria":[{"fieldName":"independence","operator":"greaterThan","value":new Date(-5341554000000)}]},"backgroundColor":"#800000","cssText":"background-color:#800000;","id":0}])');
    You'll see a hilite was applied for the Nationhood column and is successfully being displayed.

    Then, click "Edit Hilites", "Add Advanced Rule", and add a rule for nationhood less than a date around 1800 and select a format color. This rule should highlight United States in the list. Click Save and save again. What happens is that both rules are now ignored.

    The reason is because the "id" of the new hilite rule doesn't get properly incremented when you do this. This is causing problems with a call to makeindex in your $63j function. It does get properly incremented when you create both rules at the same time but not if you are initially loading one of the rules from a DB or other data store.

    #2
    This issue has been resolved in the 8.3d branch for some time but the fix was never ported to 8.2p.
    We have now ported the fix across. It should show up in 8.2p in the next nightly build

    Regards
    Isomorphic Software

    Comment


      #3
      Looks good, thanks for the prompt response.

      Comment

      Working...
      X