1. #1
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    73
    Vote Rating
    0
    Peter Tierney is on a distinguished road

      1  

    Default 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.

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,358
    Vote Rating
    127
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      1  

    Default


    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

  3. #3
    Sencha User
    Join Date
    May 2010
    Posts
    111
    Vote Rating
    1
    sajan is on a distinguished road

      1  

    Default


    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
    Code:
    var geoCoordinates=Ext.create('MyApp.store.coordinateStore',{});geoCordinates.load({
        scope: this,
        callback: function(records, operation, success) {.......}})
    Now the data is already there in geoCoordinates store.
    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

  4. #4
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    73
    Vote Rating
    0
    Peter Tierney is on a distinguished road

      1  

    Default


    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.

Thread Participants: 2