Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am using Extjs 4.0 , and I need a callback method for store.sync() method? Does anyone have a solution? Thanks a lot!

like image 981
nothing Avatar asked Jan 18 '23 13:01

nothing


2 Answers

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
        });
like image 126
Mike Avatar answered Feb 05 '23 17:02

Mike


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) {
    }

...
}
like image 41
Javier Gutierrez Avatar answered Feb 05 '23 16:02

Javier Gutierrez