3

I have an EditorGridPanel with a ComboBox in one of the columns.
Within a 'select' event listener for that ComboBox, I'd like to know which grid row (not ComboBox row) it is on.
The reason is that I'd like to update a different column in the grid every time an item is selected.
I think I'm likely missing something obvious.

Thanks for any help.

code4jhon
  • 5,725
  • 9
  • 40
  • 60
Gerrat
  • 28,863
  • 9
  • 73
  • 101

3 Answers3

2

As of 4.1, it might be best to use the edit event of the grid instead. You get passed in an event which contains the edited record.

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.Panel-event-edit

Chris Farmer
  • 24,974
  • 34
  • 121
  • 164
  • what if I want to use a property from the record that is being selected in the combo? I think that in the edit event I can only access displayField and valueField - rather than the whole record of the store binded to the combo. – code4jhon Apr 15 '15 at 15:28
  • I don't know what you mean. The event has a `record` property that is the record in question. Why won't that work for you? – Chris Farmer Apr 15 '15 at 16:29
  • 1
    that is the grid store record, I want the combo store record – code4jhon Apr 15 '15 at 18:24
  • The combo isn't there anymore at the time that your event is fired. You'd have to have that combo store be accessible from your view. Then you could just find it from your edit event handler. That would be easy. – Chris Farmer Apr 15 '15 at 20:49
  • yes, I created a reference to that store through Ext.ComponentQuery.query and then with the value that I do have of the record that I want I did findExact('UniqueId', val); thanks – code4jhon Apr 15 '15 at 20:53
1

Ok, for anyone else looking to try this, I found what seems to be an undocumented property of an EditorGridPanel: activeEditor.
This property contains a 'record' property that is a reference to the current record of the ComboBox (or anything really) being edited.
It may be a little frail (since it's undocumented), but seems to work.

In ExtJs 4.2, the property of the grid (for cellediting plugin) to use is:

grid.editingPlugin.getActiveRecord()

The property editingPlugin still seems undocumented, while getActiveRecord() is.

Lorenz Meyer
  • 19,166
  • 22
  • 75
  • 121
Gerrat
  • 28,863
  • 9
  • 73
  • 101
0

Also in ExtJS 6 you can use undocumented property context which contains record.

grid.editingPlugin.context.record
Mike
  • 51
  • 2