PDA

View Full Version : toggle columns editable or not



ttbgwt
13 Apr 2012, 6:10 AM
I used to be able to do this in 3.4, but can't figure out how to do it in 4.1?



var cm = grid.getColumnModel();
cm.setEditable(cm.findColumnIndex('asset_class'), true);

ttbgwt
13 Apr 2012, 9:25 AM
I've gotten this far, but I don't even want a cell's editor to appear. How can I turn off and on cell editing?



var columns = me.getView().getHeaderCt().getGridColumns();
var i;
for (i = 0; i < columns.length; i++) {
if (columns[i].getEditor() !== undefined) {
columns[i].getEditor().setReadOnly(!state); //this only makes editor readonly, I want to disable editor
}
}

ttbgwt
13 Apr 2012, 9:35 AM
Figured it out:


//create cell editing plugin
var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners: {
beforeedit: function (e, editor) {
if (!me.cellEditingEnabled) {
return false;
}
}
}
});