Results 1 to 4 of 4

Thread: How to manage HttpProxy' Stores requests

  1. #1

    Default How to manage HttpProxy' Stores requests

    Hey guys,

    In my company we have a UI framework ExtJs based. So there are plenty of "extensions" of Ext components: we have our own grid, drop, formPanel and so on ...

    For each component requiring a store there is a JsonStore with a HttpProxy similar to the code below:

    // ExtJs 3.4 = new{
            reader: new{ 
                                              root:                    'data.records',
                                              activePage:          '',
                                              lineProperty:        'data.line',
                                              totalProperty:       'data.count',
                                              messageProperty: 'data.exception' },
            proxy: new{ url: this.url}),
            pageSize: this.pageSize
    Most of the time, our pages look like desktop apps and there is an hierarchical relationship between components. So, to manage the components state/relationship, there is a main function (called "dep.revalidate") to manage a generic store. Each component "extends" this function as well.

    Let's see an example:
    1. Let's say I have 3 filter fields (two searchbox and one date box);
    2. Below there is a custom gridPanel which depends on filters' data;
    3. Finally, a custom card layout panel which depends on line selected in the grid;
    Any change in the filter fields triggers load in the grid and after grid is ready, by default, firstRow is selected and the information is loaded in the card layout panel. This works fine.
    Let's say now, gridPanel is taking too long to retrieve its request and user change any criteria in the filter: well, all components we have, already works in a cascade invalidation system, so when parent changes children are set to invalid and after parent is ready children will be reload.

    But I'm worried about requests handling ...

    So, when user changes the filter when another request was loading dep.revalidate does something like this:

    this.activeRequest =;
    if (this.activeRequest !== undefined && this.activeRequest != null){          
      Ext.Ajax.abort(); = null;
      if (( && ( && ( instanceof Function)){
        // calling callback function with success == false, [], null, false);
    this.activeRequest == null;
    And this also works fine for me (you might be thinking: "so WTF?").

    My doubts are regarding request handling ...

    Is it secure to call Ext.Ajax.abort() ? I guess it is cancelling my last request, but I'm not sure that this is always happening ...

    What is the meaning of store.proxy.activeRequest? Is this the current/last request?

    What about the way I initialize the proxies in the stores (proxy: new{ url: this.url})) ?
    Is it ok? Should I initialize a for each proxy and keep its "tId" so I can be sure when cancelling requests by calling Ext.Ajax.abort(tId)? What about initialize a proxy each time I load a store? Is there any good knowing pattern for that?

    Any hints will be very welcome!!!

    Thanks in advance and sorry about the long, long text ;-)

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    If before the request returns and you execute the Ext.Ajax.abort it will abort the request. You can confirm this in the network dev tools and it should say canceled.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:

    Posts are my own, not any current, past or future employer's.

  3. #3


    Ok. But what if there are several request ongoing?

    So, is Ext.Ajax.abort() cancelling only the last request?

    What about the way I'm handling request (initializating/cancelling)? Is this the correct approach?

    Thanks for replying ...

  4. #4


    Still thinking about this ...

    I would like my component to cancel a request before creates another request only if the there is a request pending for this component. What is happening now is that only last request gets cancelled no matter who creates it.

    Any hint how to achieve that?

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