Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User Zyclops's Avatar
    Join Date
    Jul 2007
    Location
    Adelaide, South Australia
    Posts
    154
    Vote Rating
    0
    Zyclops is on a distinguished road

      0  

    Default Loading Child Nodes

    Loading Child Nodes


    I can't find a way to load all the child nodes in a tree. I'm using AsyncTreeNode as the root node but each of the children do not seam to populate node.childNodes until you call expand. I've provided the entire tree in json, and it doesn't need to any xhr requests to get the additional nodes.

    I've tried setting preloadChildren: true in the treeloader settings (but that must be for something else).

    The end result is i want to be able to traverse the entire tree whether or not that particular node is displayed on the screen.

  2. #2
    Sencha User Zyclops's Avatar
    Join Date
    Jul 2007
    Location
    Adelaide, South Australia
    Posts
    154
    Vote Rating
    0
    Zyclops is on a distinguished road

      0  

    Default


    I've just tried hendricd's solution at http://extjs.com/forum/showthread.php?p=69834#post69834 but found that didn't load the node.childNodes either.

    I've also tried copying
    Code:
      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]));
                    return;
                }
            }
    out of Ext.tree.AsyncTreeNode.expand but couldn't get it to work without loadComplete.createDelegate(this, [deep, anim, callback]) expanding the node.

    suggestions?

  3. #3
    Ext User para's Avatar
    Join Date
    Apr 2007
    Location
    Redmond, WA
    Posts
    918
    Vote Rating
    -2
    para has a little shameless behaviour in the past

      0  

    Default


    I'm having the same general problem. My current solution is to simply expand and collapse the tree. It takes a while to load, but at least it works.
    Sorry I can't be more help.

  4. #4
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default Just happened to be working on this very issue..

    Just happened to be working on this very issue..


    @Zyclops: That thread only sets you up to 'not have to Asynchtree load again' any child nodes after the first expand.

    I've studied the Treeloader [2.0] code, and I don't think the preloadChildren option is going to do what you (and I) wanted. (because it doesn't traverse the first level ) , but we can use it ourselves that way !

    I'll offer the approach I'm using succesfully:

    First, a proposed enhancement (for completeness ): Return the any loader (custom or not) defined at the loader, attributes, or tree level:
    Code:
    Ext.override(Ext.tree.AsyncTreeNode, {
        expand : function(deep, anim, callback){
            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);
                    }
                }.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.getLoader();
                if(loader){
                    loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback]));
                    return;
                }
            }
            Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback);
        },
        
        getLoader : function(){
           return this.loader || this.attributes.loader || this.getOwnerTree().getLoader();
        }
      });
    Then for [2.0] example:
    Code:
    var tree =  new Tree.TreePanel({
                animate:false,
                enableDD:false,
                containerScroll: true,
                autoScroll: true,
                loader: new Tree.TreeLoader({dataUrl:config.url, preloadChildren:true })
                // this adds a root node to the tree and tells it to expand when it is rendered
                ,root: new Tree.AsyncTreeNode({draggable:false,expanded:false})     
                ,id : 'testTree'
              }};
    
    tree.root.getLoader().on('load', function(loader, node){
                      // convert attributes.children to childNodes without rendering
                      node.eachChild(loader.doPreload, loader); 
                           
                    });
    
    
    //Now load the tree
    tree.getRootNode().expand(); // load and render level 1 childNodes only
    For 1.1.1 Try:
    Code:
    Ext.override(Ext.tree.TreeLoader, {
       doPreload : function(node){
               if(node.attributes.children){
                     if(node.childNodes.length < 1){ // preloaded?
                         var cs = node.attributes.children;
    
                         for(var i = 0, len = cs.length; i < len; i++){
                             var cn = node.appendChild(this.createNode(cs[i]));
                             this.doPreload(cn);
                          }
                     }
                }
            }
    });
    
    var loader =  new Tree.TreeLoader({dataUrl:config.url});
    var anode = new Tree.AsyncTreeNode({draggable:false,expanded:false, loader:loader});
    
    loader.on('load',function(loader, node){
                      // convert attributes.children to childNodes without rendering
                      node.eachChild(loader.doPreload, loader); 
                           
                    });
    tree.setRootNode(anode);
    tree.render();
    anode.expand(false,false);
    [tags : Tree convert children childNodes without rendering]
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  5. #5
    Ext User
    Join Date
    Oct 2007
    Posts
    6
    Vote Rating
    0
    robophonic is on a distinguished road

      0  

    Default


    I am trying to do this also. I just tried the above code for 1.1.1, but it didn't work. It seems that the TreeNode.beginUpdate() method does not exist in 1.1.1. Also, I believe it should be Ext.override rather than Ext.extend.

    Anyone else had luck getting this to work?

  6. #6
    Ext User
    Join Date
    Oct 2007
    Posts
    6
    Vote Rating
    0
    robophonic is on a distinguished road

      0  

    Default


    I was able to get the Ext 2.0 code working (thanks Doug!) after fixing a typo:

    Code:
    tree.root.getLoader().on('load': function(loader, node){
                      // convert attributes.children to childNodes without rendering
                      node.eachChild(loader.doPreload, loader); 
                           
                    });
    should read:

    Code:
    tree.root.getLoader().on('load', function(loader, node){
                      // convert attributes.children to childNodes without rendering
                      node.eachChild(loader.doPreload, loader); 
                           
                    });
    Still no luck with 1.1.1 though...

  7. #7
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Cool Combine and Konquer.

    Combine and Konquer.


    OK, I merged both versions, fixed the typos, and removed the non-1.1.1 stuff.

    @robophonic - I've moved all my work to 2.0+, so the 1.1.x solution still stands but haven't snapped a working model together. Review my earlier post, try again on 1.1 as let's see where you are...
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  8. #8
    Ext User
    Join Date
    Oct 2007
    Posts
    6
    Vote Rating
    0
    robophonic is on a distinguished road

      0  

    Cool Now we are cooking with microwaves

    Now we are cooking with microwaves


    @Doug: I just tested the new 1.1.x code and it works. Woot!

  9. #9
    Sencha User Zyclops's Avatar
    Join Date
    Jul 2007
    Location
    Adelaide, South Australia
    Posts
    154
    Vote Rating
    0
    Zyclops is on a distinguished road

      0  

    Default awesome!

    awesome!


    hendricd: your solution worked perfectly! thank you for spending the time to type and post your solution, it saved me a lot of headaches!

    This thread should be marked solved

  10. #10
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default Related thread post

    Related thread post


    here
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.