Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: How to stop loading animation in AsyncTreeNode

  1. #11
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Yes, it will fix your issue. It should not call all that code if there is no loader.

    It should not start the loading animation. There's no loader, so it will never end.

    Add that functino to your overrides and see.

  2. #12
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    You are loading nodes yourself in that function?

    Write your own loader, and use that in your AsyncTreeNode. It's just an object which implements the load(node, callback) method.

  3. #13

    Default

    What i want to obtain is still display the loding animation, but have a custom load function. I will go for the second solution. I'll try to make a loder by my own.

    tx

    Francesco

  4. #14

    Default

    Hmmm... I guess this is all about a bad use of AsyncTreeNode.
    I first chose this object rather than TreeNode because I thought it was the only one designed for any tree that completes as user expands nodes by clicking on them.
    Anyway my code does not use any remote XML or JSON http resources. It just use a local XML Dom object (progressive loading is necessary because I deal with huge XML files).

    Perhaps AsyncTreeNode is designed for remote HTTP requests only ? This could explain why the icon doesn't stops.. There is no http status change event just because there is no URL loaded.

    I should try the same code with simple TreeNodes (they also got the 'expand' event).

  5. #15

    Default

    Oups... I didn't read the second page of this post.
    I'm gonna try to write my own loader too.
    It will be best than dealing with 'expand' event (especially the code to fill the tree will be called only once and not every time the node is expanded).

  6. #16
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    The animation stops when the loader completes its processing and calls its callback.

    If you don't have a loader, then the animation will not stop.

    This is the bug I highlighted with the fix.

  7. #17

    Default

    Thanks Animal !
    I just created an object thats implements the load(node, callback) method and it works perfectly.
    Thanks again.

    Jacob

  8. #18
    Sencha User HCammus's Avatar
    Join Date
    Sep 2007
    Location
    Colombia
    Posts
    80

    Default

    I use this:

    PHP Code:
        /**
         *  Allow: Stop loading No-Leaf Node.
         *  Author: HACKPRO TM
         */
        
    Ext.override(Ext.tree.TreeLoader, {
            
    load: function(AB) {
                if (
    this.clearOnLoad) {
                    while (
    A.firstChild) {
                        
    A.removeChild(A.firstChild);
                    }
                    
                }
                
                if (
    this.doPreload(A)) {
                    if (
    typeof B == "function") {
                        
    B();
                    }
                    
                } else if (
    this.dataUrl || this.url) {
                    
    this.requestData(AB);
                } else if (
    typeof B == "function") {
                    
    B();
                }
                
            }
            
        });
        
        
    Ext.override(Ext.tree.TreeNodeUI, {
            
    updateExpandIcon : function() {
                if (
    this.rendered) {
                    var 
    this.nodec1c2;
                    var 
    cls n.isLast() ? "x-tree-elbow-end" "x-tree-elbow";
                    var 
    hasChild n.hasChildNodes();
                    var 
    cls1 '';
                    
                    if (
    hasChild || n.attributes.expandable || n.attributes.isFolder) {
                        if (
    n.expanded) {
                            
    cls1 "-minus";
                            
    c1 "x-tree-node-collapsed";
                            
    c2 "x-tree-node-expanded";
                        } else {
                            
    cls1 "-plus";
                            
    c1 "x-tree-node-expanded";
                            
    c2 "x-tree-node-collapsed";
                        }
                        
                        if (
    this.wasLeaf) {
                            
    this.removeClass("x-tree-node-leaf");
                            
    this.wasLeaf false;
                        }
                        
                        if (
    n.attributes.isFolder && n.attributes.leaf) {
                            
    cls1 '';
                        }
                        
                        
    cls += cls1;
                        
                        if (
    this.c1 != c1 || this.c2 != c2) {
                            
    Ext.fly(this.elNode).replaceClass(c1c2);
                            
    this.c1 c1this.c2 c2;
                        }
                        
                    } else {
                        if (!
    this.wasLeaf) {
                            
    Ext.fly(this.elNode).replaceClass("x-tree-node-expanded""x-tree-node-leaf");
                            
    delete this.c1;
                            
    delete this.c2;
                            
    this.wasLeaf true;
                        }
                        
                    }
                    
                    var 
    ecc "x-tree-ec-icon " cls;
                    
                    if (
    this.ecc != ecc) {
                        
    this.ecNode.className ecc;
                        
    this.ecc ecc;
                    }
                    
                }
                
            }

        }); 

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •