View Full Version : Get reference to a combo box within an editable grid

25 Mar 2011, 10:26 AM
Is it possible to get a reference to the store of a combobox inside an editable grid? In my code example below "my_field" is a combobox inside an editable grid. I would like to get hold of the store of the combobox within the "afterEdit" of the grid.

afted_edit: function(e) {
if (e.field == 'my_field') {
# var store = get reference to the store of the combo here.

25 Mar 2011, 1:56 PM
Short answer - It depends on how you set up the editor

Combos have a select event which may do what you want.

Failing that, if you set up your editor as with domething like:

editor: new Ext.form.ComboBox({....});

then no. The reference is destroyed upon completion of the edit. If however you were to define an editor and then reference it you should be able to access it ok (provided you get your scope right).

25 Mar 2011, 8:46 PM
In that case I have no choice but to put an id on the combo and use getCmp. I use Designer and I do not want to hand modify the ui.js.

Thanks for your input!

26 Mar 2011, 6:54 AM
As I said, that wont work. The combo will be destroyed after the selection is made, unless you are using a reference to it. Will the select event not work for you? It fires after a selection is made in the cobo and you can access the store from there.

26 Mar 2011, 10:00 AM
Hi again.

I have not yet tried that actually. I'm very new to Ext but I think I understand now. Earlier I did not understand that the combo itself was getting destroyed when editing was done. I am going to try using the 'select' or maybe 'change' event and I'm sure it will work.

Thanks a lot!