PDA

View Full Version : Abort store load requests



mbharathiraj
15 May 2012, 10:11 AM
Hi,

I have a window with a tab panel that has two tabs. Each tab contains a grid panel. Data will be loaded to the grid(multiple ajax requests) while opening the window using store load method. The issue is if the user closes the window before the store request completes then there is a javascript error thrown 'Store is null'.

My question is when user closes the window, how can I abort all the store requests?

Can someone please help?

scottmartin
15 May 2012, 12:08 PM
You can abort the request:



var ajaxId = Ext.Ajax.request({ .. });
Ext.Ajax.abort(ajaxId);


Regards,
Scott.

mbharathiraj
15 May 2012, 12:28 PM
Scott - Thank you very much for your quick reply.

I'm using Ext.getCmp('myGrid').store.load() to load the data in the grid. I also tried Ext.Ajax. abortAll() method in the window close. But I got the error 'Object doesn't support this property'.

So you mean I should use Ext.Ajax.request instead of store.load(). Sorry If I misunderstood your post.

scottmartin
15 May 2012, 12:40 PM
I saw ajax in your original post ..
You can use data.connection.abort() to cancel last request.

Regards,
Scott.