nothing
nothing

Reputation: 61

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!

Upvotes: 4

Views: 9653

Answers (3)

Mike
Mike

Reputation: 1013

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

Upvotes: 8

Javier Gutierrez
Javier Gutierrez

Reputation: 559

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

...
}

Upvotes: 1

suknic
suknic

Reputation: 645

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.

Upvotes: 0

Related Questions