Results 1 to 5 of 5

Thread: One Store acting as Multiple

  1. #1
    Sencha User
    Join Date
    Feb 2014

    Default One Store acting as Multiple

    I have a large json data file from which many different combo box needs to be made.
    Now i have stored this json in store (Big Store).

    1) Now, should i use this Big Store and change reader of store dynamically and use data to fill in combo box ?
    (I don't know whether changing reader is possible or not)

    2) Or can i copy data from big store to different stores (on condition basis like reader) ?
    if yes, then how ?

    3) Last is the way i was trying to avoid, Making multiple stores and readers, calling data many times and filling combo box. :|

    Please guide me on the correct and best approach.

  2. #2
    Sencha Premium User westy's Avatar
    Join Date
    Feb 2009
    Bath, UK


    You can share a store easily using the storeId config, and referencing it as a string from your combobox, ensuring it's created in time.

    You can get issues if want to use the same store in multiple combos on the same form though, since filtering one effects others.
    Having multiple store ids helps here though, although will probably have to load the data multiple times (since not worth the effort in trying to cancel the load etc, although can be done).

    I think that is what you're asking anyway, isn't it?

    Product Architect
    Altus Ltd.

  3. #3
    Sencha User
    Join Date
    Nov 2012


    Due to issues with combo boxes automatically filtering when users type into the field (if you allow that), using a single store for multiple combo boxes is a nightmare. You can turn off some features like "typeAhead" to avoid these issues, or else use a different store for each combo box.

    You don't have to do multiple loads, however - you can clone your store.

    Such as this code in the store definition:

    listeners: {
            // Duplicate to second clone... 
            load: function(thisstore, records, successful){
                var newrecords = [];
                    function (r) {
                        newrecords.push (r.copy());
                // Change us to local...
                thisstore.remoteFilter = false;
                thisstore.remoteSort = false;
    See also this thread:

  4. #4
    Sencha Premium User varsos's Avatar
    Join Date
    Feb 2008
    Long Island, NY


    You could cache the data after the ajax call, then have the combos with store and memory proxy read the portion of the data they need.

  5. #5
    Sencha User
    Join Date
    Feb 2014


    Thanks for the replies guys, i found my answer in this Post (written by Farish) :

    you can load all data in one request and then go through it and use your criteria to differentiate the data to find out which data goes in which store. you can create an array of data for each store and use store.loadData(dataArray); to load the data into the array. you WILL need a separate store for each combobox in this case but you will only be loading data once in your main store. you should also set the combo's queryMode to 'local'.

    May be it will help Others.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts