PDA

View Full Version : How to control whether the grid is editable or not in ExtJS 4.1.1 ?



panbayi
8 Jan 2013, 1:34 AM
I need to switch the editable status of grid. For example,if I click the 'edit' button, it makes me able to edit the data in grid .Otherwise the grid stays uneditable

How can I make it?

Your help is needed and appreciated

LarssaAndin
8 Jan 2013, 2:37 AM
I suggest that you add a beforeedit listener to your edit plugin.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.plugin.CellEditing-event-beforeedit

In this listener you just check a variable in your grid to see if it is currently editable. Returning false from this listener will block editing.

panbayi
8 Jan 2013, 5:53 PM
Thank you for your advice.I solved it by editing.enable() and editing.disable(),
and I have to modify the source code cellediting.js to make the variable 'disabled' work(I'm surprised that the source code did not use the 'disabled' at all);