1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    20
    Vote Rating
    0
    amitayh is on a distinguished road

      0  

    Default Weird tree loading behavior

    Weird tree loading behavior


    As asked in Stack Overflow:

    I have a tree panel which uses an ajax store. When the server fetches results for a node, it's usually not instantaneous (takes a few seconds).


    I have another grid control which reloads the root node (depending on different parameters)


    This may cause weird behavior when a request is sent before the previous one is completed:
    1. A user selects something on the grid, which causes the tree to send a request
    2. Before the previous request is complete the user changes something which causes a new request to be sent
    3. The tree starts to have problems when expanding nodes after both requests are complete
    Is there a way for me to abort all pending requests sent by the tree store before reloading the tree?


    Thanks in advance for your help!
    Amitay.

  2. #2
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    358
    Vote Rating
    15
    Zdeno will become famous soon enough

      0  

    Default


    Aye, there is solution how you can solve your problem.

    Code:
    Ext.override(Ext.data.proxy.Ajax, {
        doRequest: function(operation, callback, scope) {
            var writer = this.getWriter(),
            request = this.buildRequest(operation, callback, scope);
    
    
            if (operation.allowWrite()) {
                request = writer.write(request);
            }
    
    
            Ext.apply(request, {
                headers : this.headers,
                timeout : this.timeout,
                scope : this,
                callback : this.createRequestCallback(request, operation, callback, scope),
                method : this.getMethod(request),
                disableCaching : false
            });
    
    
            this.lastRequest = Ext.Ajax.request(request);
            return request;
        }
    });
    1) Check http://docs.sencha.com/ext-js/4-1/#!...erty-autoAbort
    In this case you need override store, add autoAbort property and do everything what do you want to do when abort function is called so:
    • add event abort in contructor
    • assign your function into beforeload event where you check lastRequest and statement of your store, when there is lastRequest and store is loading new response you will call Ext.Ajax.abort(lastRequest))
    2) Call Ext.Ajax.abort on proxy request

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    20
    Vote Rating
    0
    amitayh is on a distinguished road

      0  

    Default


    Hi Zdeno, thanks for you reply. I will try this direction...

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar