I have a checkbox column in my grid that displays Yes/No based on checkbox selection.
Requirement: If checkbox value == Yes, change row color Green Else Leave as is (default).
Steps I have taken so far: On Ext.grid.View set the getRowClass function, something like this:
viewConfig: {
getRowClass: function(record, rowIndex, rowParams, store) {
if (record.get('isApproved') == true)
{
return 'highlight-rowgreen';
}
},
This works perfectly fine. However I want achieve this in a store.sync callback which is not happening at the moment. There is no error, nothing. Just doesnt work.
var store = Ext.getStore('MyApp.MyStore');
store.proxy.url = MYAPP.globals.url + "myapplication/" + branchNo + "/event/" + branchEventId;
store.sync({
scope: this,
callback:function (records, operation, success) {
if(records.proxy.reader.rawData.success){
// Success. Set the rows color to green if not already done.
alert('Update Completed');
eventsGrid.getView().getRowClass = function(record, rowIndex, rowParams, store){
console.log('I am here');
if (record.get('isApproved') == true)
{
return 'highlight-rowgreen';
}
};
}
else{
alert('Update failed');
}
}
});
What I cant see is my console log "I am here". I can see the Alert message alright.
I have tried other solutions as well like this but not happening.
Any help is appreciated. Thanks
getRowClasswill be called every time. It does not matter how the data gets changed — locally only or with the involvement of remote sync. Therefore there is no need to re-definegetRowClassanywhere like you are doing in sync callback. Data change will result in re-rendering the row and placing or removing yourhighlight-rowgreenclass accordingly. See this example. - Greendrake