PDA

View Full Version : How to get responsecode from store callback?



BarbaraM
22 May 2013, 6:12 AM
i'm trying to handle session timeout server-side. When getting session timeout, my server send back a response with json {success: false}, ContentType: 'application/json', ResponseNo: 408

store:

var storeAssets = Ext.create('Ext.data.Store', {
model : 'modCombo',
autoLoad : false,
proxy : { limitParam : undefined,
startParam : undefined,
paramName : undefined,
pageParam : undefined,
noCache : false,
type : 'ajax',
url : '/caricaAssets.json',
reader : { root : 'data' }
}
});

And client side, i handle callback loading store, like this:

storeAssets.load({
scope: this,
callback: function(records, operation, success) {
if (!success) { Ext.Msg.alert('Error'); }
}
});

To perform different responses, i'd like to change alert. So, if response no. is 408, i can alert "session expired" (and so on, managing response numbers)

But i didn't find any way to get response no. in store callback!!!!!

Any suggest? Thanks

friend
22 May 2013, 6:21 AM
See this thread (http://www.sencha.com/forum/showthread.php?264147-How-Retrieve-ResponseText-following-store.load%28%29-failure).