-
5 Jan 2013 10:33 AM #1
Reusing Stores Throughout Application
Reusing Stores Throughout Application
I have setup value stores in my application and want to use these stores and their contained data in multiple views. Value stores are standardized list of data used in combo boxes or other controls to limit user input to valid values. These only need to be loaded once and I have them loading when the main viewport loads.
As an example, I have two combo boxes using the same store and when I open each combo, a request is sent to the server to retrieve the data. Maybe I don't fully understand all the options of a store, but if I have the store set as a singleton and the data is already loaded, why is it still making the server request the second time? It shouldn't be making subsequent request unless explicitly reloaded.
Any help on what I might be missing is appreciated.
-
7 Jan 2013 11:52 AM #2
Sounds like you need to change the queryMode from 'remote' to 'local'.
http://docs.sencha.com/ext-js/4-1/#!...-cfg-queryMode
This might not be exactly what you need though. If you re-use that same store across all of the applications comboboxes they will all synchronize. So if you filter it or a user searches, it will change on all comboboxes. Depending on your situation this may (not) be what you want.Aaron Conran
@aconran
Sencha Architect Development Team
-
10 Jan 2013 10:18 AM #3
this is what I also need.
I have 2 views one main view port which loads a map from a store. on afterrender event
My code is like this
Now the data is already there in geoCoordinates store.Code:var geoCoordinates=Ext.create('MyApp.store.coordinateStore',{});geoCordinates.load({ scope: this, callback: function(records, operation, success) {.......}})
I now want to use the same store's record on another window on the same afterrender effect.
I have been struggling on this for couple of days but no solution.
Please help me.
thanks
-
10 Jan 2013 11:40 AM #4
Setting the combobox to queryMode: local did solve the multiple requests to the server. Good to keep in mind about the filtering as I'm sure that would catch you when least expected.


Reply With Quote