Search code examples
extjstreestore

Extjs how to create a new instance of the store without modifying the old one


I have a store that I call like this:

var store = Ext.getStore('mysotreid');

mystoreid matches with mycomponent.mystore.

then I create a new instance of the store like this:

var newStore = Ext.create('mycomponent.mystore', {
            autoDestroy: true
        });

then I call the load for newStore like this:

newStore.load({
            callback: function(items) {
              ...
            }
);

The thing is that if I call var store = Ext.getStore('mysotreid') it is not the oldone store, but newStore. How can I load newStore without modifying the old store?


Solution

  • The second one Ext.create('Ext.data.Store') with same storeId override reference. After that Ext.getStore('storeIdentifier'); has reference to last.

    Look on fiddle: https://fiddle.sencha.com/#view/editor&fiddle/2sas