PDA

View Full Version : EditorGridPanel with GridRowEditor



filipk
7 Oct 2010, 7:49 PM
I'm using the EditorGridPanel with GridRowEditor and need to selectively enable disable some of the column / cell editors. The logic is different for each row so in the 'beforeedit' event I determine based on a particular value in the store what is and isn't editable, then I try the following:

// set default value - col 0 is editable
myGrid.getColumnModel().setEditable(0, true);
// set based on some condition
if (isEditable === false) {
// col 0 is NOT editable
myGrid.getColumnModel().setEditable(0, false);
}

problem is, whatever condition is set first, it will be applied to all the rows.
The "isEditable" does get set correctly.
Do I need to call some form of doLayout()??

thanks in advance

filipk
7 Oct 2010, 8:11 PM
I also tried to use:

var editor = myGrid.getColumnModel()..getEditor(0, rowIdx);
editor.enable(); and editor.disable();

as well as editor.setDisabled(false); and editor.setDisabled(true);

when I inspect the component in firebug, it's "disabled" property is correctly set, however, it still doesn't render correctly.

If I set the editor as disabled in the initial config, then it's rendered as expected.

Condor
8 Oct 2010, 12:04 AM
Shouldn't that be:

var editor = myGrid.getColumnModel().getCellEditor(colIndex, rowIndex);

filipk
8 Oct 2010, 12:20 AM
Hi Condor,

Yes, sorry, that is exactly what I have, just did not type it in correctly.
As I said above, when I inspect the component properties via firebug, the disabled property is correctly set but as far as rendering - it's not happening.
Thanks,
Filip

Condor
8 Oct 2010, 12:51 AM
Which Ext version are you using?

On older versions you would need to use:

var editor = myGrid.getColumnModel().getCellEditor(colIndex, rowIndex).field;

filipk
8 Oct 2010, 1:05 AM
Hi Condor,

I'm using 3.1.0, adding the '.field' did the trick.

Thank you

filipk
8 Oct 2010, 2:31 AM
Which Ext version are you using?

On older versions you would need to use:

var editor = myGrid.getColumnModel().getCellEditor(colIndex, rowIndex).field;

just in case someone else runs into this. I just upgraded from 3.1.0 to 3.2.2 and I still have to use the .field in order for it to work.

Thanks again Condor