PDA

View Full Version : Cancel load success event?



innivodave
9 Dec 2009, 1:25 PM
Hi all,
I have a form which loads in a new set of form items and then calls form.load() to populate, when various buttons are clicked on. The problem is, if a button is clicked before the previous load has completed, the old load success event still get fired. Is there a way to cancel the previous 'success' event?

Thanks
Dave

Gjslick
9 Dec 2009, 3:55 PM
Well what you'd really have to do is abort the first AJAX request before the second one is made, so that the first request does not complete, and therefore does not call its success handler. But unfortunately, at this time, it doesn't seem like there is any way to get the transactionID of the internal load action's call to Ext.Ajax.request().

You might try running Ext.Ajax.abort() when the load button is clicked, which should abort the last request made to the Ext.Ajax object. The only thing is, if you have any other ajax requests on your page, you might mess them up by accidentally aborting the wrong request.

Otherwise, you might just want to disable that button that loads the data until any other request has completed (or failed).

Hope that helps.