I want to add a function to the Store Class for cleaning the store(proxy+data+sync), which I can call it via myStoreVariable.cleanAll();
or Ext.getStore('storeId').cleanAll();
My first attempt is this, but I can't call this function from the store:
Ext.data.Store.cleanAll = function() {
this.getProxy().clear();
this.data.clear();
this.sync();
};
My second attempt is this:
this.storeStore = Ext.create('Ext.data.Store', { id: 'myStore', model: 'myModel' });
this.storeStore.cleanAll = function() { /* my cleaning code(see above) */ };
It is working, but I don't want to define cleanAll for all of my stores.
Do you know any possibility to add this function to the store class? So I can call it from any store I create via Ext.create('Ext.data.Store',
Ext.create('Ext.data.Store', { id: 'myId', model: 'myModel' });
. But I want the function for all stores. – Niklas