Hi, I really like the hilites system for grids, as an alternative to having to define CSS styles (which could potentially require changes if the skins are modified).
Unless I’ve missed something, its main limitation is that it doesn’t have states, i.e., for hover or selected.
May I ask if you’ve ever considered, or have plans for, evolutions in this regard? And do you generally think it’s a good idea, or is the classic method preferable?
I was experimenting to see if something like this could be simulated with the current system, and this seems to work:
Would this kind of approach be considered “safe,” or do you see any issues with it?
Unless I’ve missed something, its main limitation is that it doesn’t have states, i.e., for hover or selected.
May I ask if you’ve ever considered, or have plans for, evolutions in this regard? And do you generally think it’s a good idea, or is the classic method preferable?
I was experimenting to see if something like this could be simulated with the current system, and this seems to work:
Code:
// array of hilite-objects to apply to the grid var hiliteArray = [ {// selected style cssText: "color:#FFFFFF;background-color:#279f45;", criteria: { _constructor: "AdvancedCriteria", operator: "and", criteria: [ {fieldName: "isSelected", operator: "equals", value: true}, {fieldName: "area", operator: "lessThan", value: 500000} ] } }, { // normal style cssText: "color:#FFFFFF;background-color:#639966ab;", criteria: { _constructor: "AdvancedCriteria", operator: "and", criteria: [ {fieldName: "isSelected", operator: "notEqual", value: true}, {fieldName: "isOver", operator: "notEqual", value: true}, {fieldName: "area", operator: "lessThan", value: 500000} ] } }, {// over style cssText: "color:#FFFFFF;background-color:#639966;", criteria: { _constructor: "AdvancedCriteria", operator: "and", criteria: [ {fieldName: "isSelected", operator: "notEqual", value: true}, {fieldName: "isOver", operator: "equals", value: true}, {fieldName: "area", operator: "lessThan", value: 500000} ] } } ]; isc.ListGrid.create({ ID: "countryList", width: "100%", height: "100%", selectionChanged:function (record, state) { record.isSelected = state; this.getDataSource().updateCaches({data: [record], operationType: "update"}) }, rowOut: function (record, rowNum, colNum) { record.isOver = false; this.getDataSource().updateCaches({data: [record], operationType: "update"}) }, rowOver: function (record, rowNum, colNum) { record.isOver = true; this.getDataSource().updateCaches({data: [record], operationType: "update"}) }, dataSource: "countryDS", autoFetchData: true, fields: [ { name: "countryCode", title: "Flag", width: 65, type: "image", imageURLPrefix: "flags/24/", imageURLSuffix: ".png" }, {name: "countryName", title: "Country"}, {name: "capital", title: "Capital"}, {name: "population", title: "Population"}, {name: "area", title: "Area"}, {name: "gdp"} ], hilites: hiliteArray })
Comment