Search code examples
extjsjsonstore

How do I retrieve all data from jsonstore in sencha


Morning,

I have created a store in my controller like this:

    var storeCompanies = new Ext.data.JsonStore({
      proxy: new Ext.data.HttpProxy({
          type: 'GET',
        url: url+'dashboard?Uid='+uid+'&Ude='+ude,
        reader: {
            type: 'json',
            root: 'root',
            totalProperty: 'total'
        },
        headers: {
           'Accept' : 'application/json;application/x-www-form-urlencoded',
           'Content-Type' : 'application/x-www-form-urlencoded',
        },

      }),
      root: 'd',
      type: 'localstorage',
      autoLoad : true,
      id: 'company_Id',
      scope : this,
      fields: ['Name']
    });
console.log(storeCompanies);

The console log shows that the store is being created and populated properly. I need to retrieve all the values for a dropdown.
I tried this but it returned undefined. All other info I have found seems to instruct on how to find just one value. What's the easiest and most effecient way to retrieve all the data?


Solution

  • storeCompanies.on('load', function() {
        console.log(storeCompanies.data); //<--- data is a Ext.util.MixedCollection
    });