Blog Archive

ExtJs 4 CheckColumn dirty markup in Grid doesn't work

Issue: It works when the cell starts as checked but if it starts as unchecked then if you check it doesn't show the dirty red mark but again if you uncheck the same cell then it shows dirty which is wrong.

Solution: The issue has been resolved in the latest release of ExtJs but if you working with an older release then here is the solution
Ext.grid.header.Container.override({
  prepareData: function(data, rowIdx, record, view, panel) {
    var obj = this.callOverridden(arguments);
    var headers   = this.gridDataColumns || this.getGridColumns(),
        headersLn = headers.length,
        colIdx    = 0,
        header;
    for (; colIdx < headersLn; colIdx++) {
      header = headers[colIdx];
      obj[header.id+'-modified'] = Ext.isDefined(record.modified[header.dataIndex]) ? Ext.baseCSSPrefix + 'grid-dirty-cell' : '';
    }
    return obj;
  }
});

Source: Sencha Forum


1 comment :