EXTJS 4.0 : how to implement callback method for store.sync() method?
I am using Extjs 4.0 , a开发者_运维技巧nd I need a callback method for store.sync()
method? Does anyone have a solution? Thanks a lot!
This should work starting from 4.1:
store.sync({
success: function()
{
console.log("success!!");
},
failure: function()
{
console.log("failed...");
},
callback: function()
{
console.log("calling callback");
},
scope: this
});
you can catch the result of each method in your store with
Ext.define('AM.store.AdreessStore', {
extend:'Ext.data.Store',
....
onCreateRecords:function (records, operation, success) {
},
onUpdateRecords:function (records, operation, success) {
},
onDestroyRecords:function (records, operation, success) {
}
...
}
Short question, short answer:
Try listening to the different events of store, like datachange
, update
or load
. Maybe one of them (or a combination of them) fires when you need them.
精彩评论