Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reuse store in EXT JS 4 MVC application without multiple reloading?

I am working on extjs 4 MVC application.

Application runs the Viewport, which contains tabpanel. Each tab has own controller and multiple views.

See my sandboxs at http://wap7.ru/folio/ext-reuseable-store/TE.html

I have one Store used several times (e.g. one tab in topmenu combobox, another in the clietns grid.) Store configured with autoload: true. Proxy is configured in the Model.

My problem: Store is loaded multiple times - at every mention in the controller [stores] array.

If I remove one from the array [stores] controller- combobox will be empty, although it states store: Ext.getStore ('STORE-ID')

Please give me a hint, or an example of re-using Store (not Model) as in here http://docs.sencha.com/ext-js/4-0/#!/guide/mvc_pt2

like image 421
Lev Savranskiy Avatar asked Nov 13 '22 23:11

Lev Savranskiy


1 Answers

You can just instantiate your store and load it, remove the autoload.

var store = Ext.create('App.store.YourStore').load();

Then pass that store to all your components, just like you would do when you want a paging bar connected to a grid.

like image 122
Johan Haest Avatar answered Dec 05 '22 15:12

Johan Haest