Hybrid View

  1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    37
    Vote Rating
    0
    harjits is on a distinguished road

      0  

    Default ABorting AJAX request

    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
    546
    Vote Rating
    53
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      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
    harjits is on a distinguished road

      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
    546
    Vote Rating
    53
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      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
    546
    Vote Rating
    53
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      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
    harjits is on a distinguished road

      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).

Thread Participants: 1

Tags for this Thread