PDA

View Full Version : How to show/hide editor field according to the row record



brunoferoleto
26 Jul 2012, 1:25 PM
Hi. I'm using Bryntum's Gantt panel. For those who doesn't know, it has a grid that inherits from treeview. I've put some editors in some columns. Some of them need to show this editor and some can't show this editor. This is based in the records of the rows. How can I do this?

Farish
26 Jul 2012, 1:57 PM
you can add a listener for the beforeedit event on the rowediting plugin of the grid.


rowediting.on('beforeedit', function(editor, e, eOpts) {
console.log(e.record.get('fieldName'));
if(e.record.get('fieldName') == "someValue")
return false; // cancel editing
});

the event object e has information about the record being edited. You can check for some value in the record and based on that, cancel editing by returning false. Check the API Docs for more details on the event object.

brunoferoleto
27 Jul 2012, 5:03 AM
Thank you very much!