PDA

View Full Version : CellEditing change editor of other cell



extjser12
16 Apr 2012, 11:07 AM
Hello together

Can somebody help me to change the editor of another cell?



plugins: [{
ptype: 'cellediting',
listeners: {
edit: function(editor, e, eOpts) {
//How can I here change the editor of the next cell on the right side (e.colIdx + 1)?

}
}
}],



Thanks for your support in advance!

Kind regards, extjser12

scottmartin
16 Apr 2012, 11:32 AM
You could just change the field value in the store itself.

Scott.

extjser12
16 Apr 2012, 11:43 AM
Is it not possible to change the editor of another field? I want to achieve, that if a specific value is selected in a combobox another cell gets another editor.

slemmon
16 Apr 2012, 5:35 PM
Looks like you can use grid.column.Column's setEditor method.
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.column.Column-method-setEditor

g (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.column.Column-method-setEditor)rid.headerCt.down('gridcolumn[dataIndex="dependantColumn"]').setEditor({...})

extjser12
17 Apr 2012, 8:50 AM
Nice. Thanks for your help! ;)

Is it also possible to extend your selector, so that it searchs for the "dataIndex" only in a specific row (e.g. e.rowIdx)?

Kind regards, extjser12

slemmon
17 Apr 2012, 9:17 AM
Hmm... I think for that I might hook into the cell/row edit event
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.plugin.CellEditing-event-edit

That would give me the row I'm working on at the time that I'm executing setEditor().

extjser12
17 Apr 2012, 9:30 AM
Yes I know. But I need an other row in the same column and I don't know how can I do this? Do you have any idea?


Kind regards, extjser12

slemmon
17 Apr 2012, 12:43 PM
Not sure how to do that exactly. I know that the setEditor is done by column, though, if that helps. Good luck.

extjser12
17 Apr 2012, 1:10 PM
Ok thanks. Maybe I can iterate throught all returned cells from the "down()" method and select then the right cell. But the "down()" method returns me only the first match. Do you maybe know how can I get all cells with the same "dataIndex"?

Thank you very much for your support!

Kind regards, extjser12

slemmon
17 Apr 2012, 2:03 PM
I've not used it, but looks like grid.getView().getCell(param1, param2) is the method you'd be after.
param1 = record you're working with
param2 = column

You'd have to iterate the store to get each record, but with the previous selector you'd have the column you're interested in.