1. #1
    Sencha Premium Member
    Join Date
    Aug 2013
    Location
    Chicago, IL
    Posts
    20
    Vote Rating
    5
    Answers
    2
    @brady is on a distinguished road

      0  

    Default Answered: abort/cancel store.load?

    Answered: abort/cancel store.load?


    In the following thread on the Ext 2.x forum:

    http://www.sencha.com/forum/showthre...cel-store.load

    The question of how to interrupt (or stop) the data store load process is posed. In response, the following code is suggested:

    Code:
    Ext.Ajax.abort(store.proxy.activeRequest);
    delete store.proxy.activeRequest;
    Based on a review of the 4.2.2 Ext.data.proxy.Proxy class source code, there is no “activeRequest” property. If you run this code, in ExtJS 4.2.2, you are effectively calling the Ext.Ajax.abort method with the request parameter undefined. Based on the body of the method, this results in the following code being exercised:

    Code:
    if (!request) {
     request = me.getLatest();
    }

    This is fine except you don’t know for certain that the last Ajax request is the one emanating from the data store. If multiple connections are in play it could pickup anyone of them. Therefore, I have the same question: In ExtJS 4.2.2 how do you interrupt/stop the Ext.data.Store load process. Note, at the outset I did search the forum before deciding to post this question. The most relevant post I found was from 2011--

    http://www.sencha.com/forum/showthread.php?136405

    However, this thread seems to indicate that the associated defect EXT-11109 is still open. Is this true--ie is there no way in ExtJS 4.2.2 to simply abort the data store load process.


    Thx,


    b

  2. There is a note from a developer on that bug ticket indicating that this will be fixed in version 5, and that one will be able to abort operations like load(). Can you try your code against ExtJS 5.0.0?

  3. #2
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    5,321
    Vote Rating
    110
    Answers
    191
    Gary Schlosberg is just really nice Gary Schlosberg is just really nice Gary Schlosberg is just really nice Gary Schlosberg is just really nice Gary Schlosberg is just really nice

      0  

    Default


    There is a note from a developer on that bug ticket indicating that this will be fixed in version 5, and that one will be able to abort operations like load(). Can you try your code against ExtJS 5.0.0?
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our human resources manager: fabienne.bell@sencha.com

  4. #3
    Sencha Premium Member
    Join Date
    Aug 2013
    Location
    Chicago, IL
    Posts
    20
    Vote Rating
    5
    Answers
    2
    @brady is on a distinguished road

      0  

    Default Question Answered

    Question Answered


    Wow,


    It only took a week for someone to reply with the obvious answer: "Upgrade to 5.0.0, duh." Provided you are able to upgrade your app to 5.0.0, this is the best (only) answer. I my case, since I have yet to succeed in upgrading (see latest question / road block), I refactored around it--i.e. I got rid of the necessity having to abort the load. Anyway, I will mark this question as answered.


    @brady

  5. #4
    Sencha User
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    28
    Vote Rating
    6
    Answers
    3
    f.baron is on a distinguished road

      0  

    Default


    Here is an easy work around to stop a store's load in ExtJS 4.

    Save in a local variable (for example as attribute of the store) the request generated by the load method:
    Code:
    store.load();
    store.lastRequest = Ext.Ajax.getLatest();
    Then you can use this variable to stop the call:
    Code:
    Ext.Ajax.abort(store.lastRequest);

Thread Participants: 2

Tags for this Thread