PDA

View Full Version : How i can set grid's column to editable by some rows if i need?



nukboon
23 Jun 2009, 1:45 AM
How i can set grid's column to editable by some rows if i need?
i don't want to set every grid's rows to editable
how i can do?
thank.

Condor
23 Jun 2009, 1:53 AM
You'll need to override the isCellEditable method of the columnmodel.

nukboon
23 Jun 2009, 2:10 AM
Wow! quickly reply
thank you so much for your solution
i have missing in API document on my self!

nukboon
23 Jun 2009, 2:23 AM
my solution is not work!
var store = new Ext.data.Store({...});
var colModel = new Ext.grid.ColumnModel({
columns: [...],
isCellEditable: function(col, row) {
var record = store.getAt(row);
if (record.get('readonly')) { // replace with your condition
return false;
}
return Ext.grid.ColumnModel.prototype.isCellEditable.call(this, col, row);
}
});
var grid = new Ext.grid.GridPanel({
store: store,
colModel: colModel,
...
});