PDA

View Full Version : locking grid does not handle action column



ggdx
28 Jan 2011, 7:10 AM
Unless I'm missing something, Ext.ux.grid.LockingGridView (in http://dev.sencha.com/deploy/dev/examples/ux/LockingGridView.js) from the locking grid exemple (at http://dev.sencha.com/deploy/dev/examples/grid/locking-grid.html) is not compatible with a column with no dataIndex (e.g. : Ext.grid.ActionColumn).

The bug is related to the following method LockingGridView#getColumnData:


getColumnData : function(){
var cs = [], cm = this.cm, colCount = cm.getColumnCount();
for(var i = 0; i < colCount; i++){
var name = cm.getDataIndex(i);
cs[i] = {
name : (!Ext.isDefined(name) ? this.ds.fields.get(i).name : name),
renderer : cm.getRenderer(i),
id : cm.getColumnId(i),
style : this.getColumnStyle(i),
locked : cm.isLocked(i)
};
}
return cs;
},
Line:


name : (!Ext.isDefined(name) ? this.ds.fields.get(i).name : name),
should be something like:


name : Ext.isDefined(name) ? name : (this.ds.fields.get(i) ? this.ds.fields.get(i).name : undefined),
(more or less what's in Ext.grid.GridView#getColumnData)

By the way, there could be a getExtraColumnData or addColumnData in Ext.grid.GridView to allow subclasses to add column config without redifining getColumnData.