PDA

View Full Version : AjaxProxy timeout results in store load failure



Al Little
5 May 2011, 12:44 AM
Hi Guys,

I am trying to handle the case where an AjaxProxy request times out.

The touch library throws an error.
sencha-touch-debug-w-comments.js line 11565

I have an exception handler which is working fine, but the library seems to try and store record data anyway.

Is there anything additional that I need to do to stop the load type methods firing when there is an exception?

Thanks,

Al

adjohnson916
28 Jul 2011, 2:31 AM
I ran into this issue as well. Not sure what the proper solution is, but I was able to get rid of some of the errors by using Ext's "interceptor" functionality to preempt the store's private OnProxyLoad method which will attempt to load the store, and returning false if the operation reports failure so that the Interceptor cancels the original function from being called. Here's the code:


var newOnProxyLoad = function (operation) {
if (operation.success === false) {
yourStore.loading = false;

// do what you want here (i.e.: notify user of failure, or load cached data, etc.)

return false; // cancels execution of originally intercepted onProxyLoad function
}
else {
// success, so don't return false, then the interceptor will call the intercepted onProxyLoad function
}
};
yourStore.onProxyLoad = Ext.createInterceptor(
yourStore.onProxyLoad,
newOnProxyLoad,
yourStore // scope
);

See http://dev.sencha.com/deploy/touch/docs/?class=Ext.util.Functions.