I have some code which creates stores on the fly from an ajax request to the server (which sends a json store).Everything works fine meaning when I check the DOM,the stores are already there. But When I insert this code in my app.js to create an instance of Countries store:
new MA.store.Countries();
I get following error:
Uncaught exception: TypeError: 'MA.store.Countries' is not a constructor
After the viewport is loaded completely, I run the same code in firebug and magically I can see the store is created and accessible.
While googling on the net i found a similar question in sencha forum but no answers are provided.
After some research and thinking i found a workaround and probably a solution.Firstly, i let my viewport created without grids that need ajax JSON stores,then i Ext.getCmp() my vieport`s tabpanel and add() and doLayout() the grids inside my viewport.ajax’s callback function so grids are only added when JSON is returned and store is created.
To see how i implemented this solution in action,you may check MedAlyser`s source