Jacob
Jacob

Reputation: 4031

Ext js Store handle failed responses

I snyc my Ext JS store in multiple places and I'm looking for a way to handle the responses in one place.

Is there a way,event or a technique to achieve this? I have tried the load event but it is not triggered by the sync method. I have also tried the metachange event of the store proxy.

Instead of calling the failure function every time a store sync is done I would like to have this in united place.

Upvotes: 0

Views: 811

Answers (1)

Francis Ducharme
Francis Ducharme

Reputation: 4987

In 4.2, you can use overrides to do this. If I remember correctly, I overrode the exception listener in Ext.data.proxy.Ajax once.

Ext.define('App.Ajax.Override', {
    override: 'Ext.data.proxy.Ajax',
    listeners: {
        exception: function (proxy, response, operation, eOpts) {
            //....
        }
    }
});

And for the successful request, perhaps the load listener of the store. I'm sorry I don't have access to the working code anymore but that should guide you a bit.

Upvotes: 4

Related Questions