Using the showCase http://www.smartclient.com/smartclie...ml#preferences
[Observation/Example]:
When you add hiliteState to the listGrid component in the example:
The code will error: ErrorType: TypeError
ErrorMessage: Cannot read property 'setProperty' of undefined.
[Solution]:
This is error is because data is undefined when settingup the hilitestate.
Switching the two lines in the init of the ListGrid would solve this:
to
[Workarround]:
Add data:[] to the create of the listgrid.
[Observation/Example]:
When you add hiliteState to the listGrid component in the example:
Code:
isc.ListGrid.create({ ID: "countryGrid", width: "100%", height: 200, leaveScrollBarGap: true, canGroupBy: true, autoDraw: false, canFreezeFields: true, canAddFormulaFields: true, canAddSummaryFields: true, dataSource: ds, autoFetchData: true, hiliteState:[ {"fieldName":"countryName","criteria":{ "fieldName":"countryName","operator":"equals","value":"France","_constructor":"AdvancedCriteria" },"icon":"","cssText":"background-color:#FF6600;","backgroundColor":"#FF6600","id":0 } ], fields: [ {name: "countryCode", title: "Flag", type: "image", width: 50, imageURLPrefix: "flags/16/", imageURLSuffix: ".png", canSort: false}, {name: "countryName", title: "Country"}, {name: "capital", title: "Capital"}, {name: "population", title: "Population"}, {name: "area", title: "Area (km²)"} ], draw : function() { this.Super("draw", arguments); viewStateTable.addData({pk: 0, name: "Default", viewState: this.getViewState()}); preferenceSelectItem.setValue("Default"); } });
ErrorMessage: Cannot read property 'setProperty' of undefined.
[Solution]:
This is error is because data is undefined when settingup the hilitestate.
Switching the two lines in the init of the ListGrid would solve this:
Code:
ISC_Grids.js@32467 // Hilite state takes precedence over hilites because it is likely applied // from a user-saved location whereas hilites is the default. if (this.hiliteState) this.setHiliteState(this.hiliteState); // initialize the data object, setting it to an empty array if it hasn't been defined this.setData(this.data ? null : this.getDefaultData());
Code:
// initialize the data object, setting it to an empty array if it hasn't been defined this.setData(this.data ? null : this.getDefaultData()); // Hilite state takes precedence over hilites because it is likely applied // from a user-saved location whereas hilites is the default. if (this.hiliteState) this.setHiliteState(this.hiliteState);
Add data:[] to the create of the listgrid.