PDA

View Full Version : Cancelling an AJAX request through a button within a loadmask?



FlaminPhoenix
24 Feb 2011, 10:08 AM
We have an ExtJS based UI which has very many components all using AJAX requests when the user interacts with them. On operations that take a long time to complete, and which have dependencies on other items, we are showing loadmasks. In some of these cases, the user may want to cancel these AJAX requests and get back to the screen. The following is my understanding and solution:

I understand the Ext.Ajax class is a singleton. Now, to do what it does, Ext should be using an identifier for each AJAX request.I found out "transId" was the variable within Ext.Ajax which is that identifier by looking at the Ext source code. Now, for the loadmask problem, Im thinking of showing a button on click of which Ext.Ajax.abort(transId) would be called.

Is this a good idea?