I have a store which I want to sync manually everytime certain actions are done.
I've seen this question and this one too.
What I'd like to know is if there is a way to establish a default sync callback functions on the store configurations.
I know I can do something like this:
store.sync({
success: function(batch, options) {
console.log('ok');
},
failure: function(batch, options) {
console.log('not ok');
}
});
But I want to define the callbacks one time in the store itself and then I would just call store.sync();
Here is an example of the store I'm working with:
Ext.define('MyApp.store.MyStore', {
extend: 'Ext.data.Store',
alias: 'store.MyStore',
model: 'MyApp.model.MyModel',
autoLoad: true,
proxy: {
type: 'rest',
url: '../../api/myEndPoint',
noCache: false,
reader: {
type: 'json',
rootProperty: 'data',
successProperty: 'success',
totalProperty: 'total'
},
actionMethods: {
read: 'GET',
destroy: 'DELETE'
},
extraParams: {
type: 'aux'
}
},
});