Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Aug 2013
    Posts
    6
    Vote Rating
    0
    endrem is on a distinguished road

      0  

    Default bug in AsyncTreeNode : expand

    when expanding a node and it has not been expanded yet - it does
    Code:
    this.ui.beforeLoad(this);
    but it doesnt do a
    Code:
    this.ui.afterLoad(this);
    which replaces all the node icons with the spinning wheel.

  2. #2
    Sencha User
    Join Date
    Aug 2013
    Posts
    6
    Vote Rating
    0
    endrem is on a distinguished road

      0  

    Default

    This will fix the problem:
    Code:
    Ext.override('Ext.tree.AsyncTreeNode', {    expand : function(deep, anim, callback, scope){
            if(this.loading){ // if an async load is already running, waiting til it's done
                var timer;
                var f = function(){
                    if(!this.loading){ // done loading
                        clearInterval(timer);
                        this.expand(deep, anim, callback, scope);
                    }
                }.createDelegate(this);
                timer = setInterval(f, 200);
                return;
            }
            if(!this.loaded){
                if(this.fireEvent("beforeload", this) === false){
                    return;
                }
                this.loading = true;
                this.ui.beforeLoad(this);
                var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();
                if(loader){
                    loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback, scope]), this);
                    this.ui.afterLoad(this);
                    return;
                }
                this.ui.afterLoad(this);
            }
            Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback, scope);
        }
    });

  3. #3
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    9,255
    Vote Rating
    251
    Gary Schlosberg has much to be proud of Gary Schlosberg has much to be proud of Gary Schlosberg has much to be proud of Gary Schlosberg has much to be proud of Gary Schlosberg has much to be proud of Gary Schlosberg has much to be proud of Gary Schlosberg has much to be proud of Gary Schlosberg has much to be proud of Gary Schlosberg has much to be proud of

      0  

    Default

    I don't believe that the AsyncTreeNode has an afterload event. Thanks for sharing your solution with the community.


    Join me at SenchaCon 2016!

  4. #4
    Sencha User
    Join Date
    Aug 2013
    Posts
    6
    Vote Rating
    0
    endrem is on a distinguished road

      0  

    Default

    AsyncTreeNode has no beforeload() either. But AsyncTreeNode extends TreeNode which has a ui member variable which is of instance TreeNodeUI, and it has both beforeload() and afterload():

    Code:
    Ext.tree.TreeNodeUI = Ext.extend(Object, {
    ...
        // private
        beforeLoad : function(){
             this.addClass("x-tree-node-loading");
        },
    
        // private
        afterLoad : function(){
             this.removeClass("x-tree-node-loading");
        },
    ...

Similar Threads

  1. Problem with AsyncTreeNode expand and collapse
    By freezq in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 20 May 2010, 12:26 AM
  2. Expand tree after AsyncTreeNode.reload();
    By kamilmajewski in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 22 Aug 2008, 8:41 AM
  3. How to make the AsyncTreeNode expand all the node
    By afei in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 13 Aug 2008, 12:21 AM
  4. AsyncTreeNode after reload ,can't expand!
    By endstar520 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 28 Mar 2008, 1:04 AM
  5. [Solved] AsyncTreeNode expand not firing?
    By adkent in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 7 Jan 2008, 4:46 PM

Thread Participants: 1