PDA

View Full Version : autoRender grid editor combos



JackJohnsonX
12 Feb 2015, 12:15 PM
Hello all,

I have an editable grid that has 4 editable columns. All 4 editors are comboboxes. When one combobox is selected I need to reload the other combos. Think of a Country/State/City scenario where states will reload depending on what country was selected, then the City combo will reload and so forth.

I listen to the combo "select" event and load the other comboxes accordingly.

The problem is, if I activate combo editor in Country column only then reload state store, I will get undefined error for the State column editor combobox since it has not yet rendered. If I manually activate all editors then invoke my "select" handler again all works fine. So there is no issue with my code.

I tried adding autoRender: true but to no avail;

My grid uses a card layout so can i listen for the activate event and then render all the editor combos?

I checked the docs and saw all components have a render( ) method but how can I call that if I cant query for a component that has not yet been rendered??

Or is it possible for me to somehow use the columns renderer function to return my comboboxes instead of the editor config?
thank you in advance

yeghikyan
5 Mar 2015, 11:29 AM
Looks like you are defining stores of comboboxes inline in combos. Just create the country, state, city stores with grids so the loading of the store/access to the combo stores will not have dependency on combo rendering. Or use Ext.create instead of xtype, then you will have access to all the methods inside. Or define your stores as global stores in the app/store directory and manage them from controller.Do you understand what I mean?

skirtle
5 Mar 2015, 8:08 PM
As yeghikyan suggests, creating the stores explicitly allows you to grab a reference to them that is not dependent on the comboboxes.

The RowEditing plugin will ensure all the fields are rendered at once, so that could be an option.

If you want to return the comboboxes from your renderer instead you'd need a user extension:

http://www.sencha.com/forum/showthread.php?148064

JackJohnsonX
13 Mar 2015, 11:07 AM
yes I was defining the stores inline. Defining the stores on the grid worked.

Thx