PDA

View Full Version : Grid, conditional editor



Jose_R
17 Aug 2010, 7:58 AM
Hi,

I am trying to make a certain column in a grid to be editable based on a certain condition (content of a different column in the same row), however I am not sure about how to implement this functionality.

I have tried to use a renderer, but even if I can generate the content of the cell, I can't disable the Editor code.

Any suggestion will be greatly appreciated

sven
17 Aug 2010, 8:01 AM
You can add a BeforeEdit event listener to the EditorGrid and cancel that event to prevent editing:
http://www.sencha.com/forum/showthread.php?106813-Make-particular-cell-editable
http://www.sencha.com/forum/showthread.php?85687-EditorGrid

Jose_R
17 Aug 2010, 8:19 AM
Thanks a lot Sven,

I had tried to perform a search but I only had found post in the EXT forum. It works perfectly when using :



grid.addListener(Events.BeforeEdit, new Listener<GridEvent>(){
public void handleEvent(GridEvent ge) {
//Disable only the even rows
if(ge.getRowIndex()%2==0) // or any other condition
ge.setCancelled(true);
}
});