View Full Version : AJAX Loads on DataStores / Combos Etc

7 Aug 2010, 9:42 PM

I'm a newb to extjs and was looking for some feedback on general patterns for alerting the user that an ajax request for some sort of data was unreachable for one reason or the other (like session expired etc.).

For example if I have the following:

var userStore = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({url: 'api/users'}),
root: 'users',
fields: ['userid', 'entity', 'domain', 'username', 'contactid', 'role']

So if I call userStore.load(); and the call fails how do I do something other than nothing that this does. I looked at the api docs and there is some reference to a callback that you could do on the records.

Just curious if anyone has an example or something along these lines to point to.

Thanks for the help.


8 Aug 2010, 10:15 PM
You can use an exception listener or a callback function.

userStore.on('exception', function(proxy, type, action, options, response, exception){
// check response.status and exception

callback: function(records, options, success){
// do stuff