Results 1 to 6 of 6

Thread: ABorting AJAX request

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    37
    Vote Rating
    0
      0  

    Default ABorting AJAX request

    Hi there,

    I'm using the following code to abort a ajax request but it doesn't seem to work. I do see that the load mask is gone but the results are still being rendered in to the grid

    Code:
    //abort the request Ext.Ajax.abort(searchStore.proxy.activeRequest);                                 //hide any masks var gMask = Ext.getCmp('searchGrid').loadMask; if(gMask && gMask.hide){  gMask.hide();  } }

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    549
    Vote Rating
    54
      0  

    Default

    Have you tried debugging to check that searchStore.proxy.activeRequest is populated prior to the abort attempt?

    Code:
    console.log(searchStore.proxy.activeRequest)
    Ext.Ajax.abort(searchStore.proxy.activeRequest);

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Posts
    37
    Vote Rating
    0
      0  

    Default

    yeah, I did. I did find the correct way to do it. It's
    Code:
    store.proxy.destroy()
    that will kill the request. I'm surprised that the code which I used to kill the request didn't work was taken from sencha documents.

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    549
    Vote Rating
    54
      0  

    Default

    In the sencha documentation, "searchStore" is the variable name of their store.

    So for example:
    Code:
    var exampleStore = new Ext.data.Store({
        ...Store Config...
    });
    Then to kill an Ajax call fired by this store:
    Code:
    Ext.Ajax.abort(exampleStore.proxy.activeRequest);

  5. #5
    Sencha User
    Join Date
    Jan 2011
    Posts
    549
    Vote Rating
    54
      0  

    Default

    Be aware that destroying the entire store proxy may also create undesired problems (any other Ajax requests after it's destroyed nay not be successful).

  6. #6
    Sencha User
    Join Date
    Nov 2008
    Posts
    37
    Vote Rating
    0
      0  

    Default

    Im totally aware of that because for each request a new object is created. Thanks for the pointer

    - Harjit

    Quote Originally Posted by willigogs View Post
    Be aware that destroying the entire store proxy may also create undesired problems (any other Ajax requests after it's destroyed nay not be successful).

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •