开发者

EXTJS 4.0 : how to implement callback method for store.sync() method?

开发者 https://www.devze.com 2023-04-11 22:30 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号