Results 1 to 7 of 7

Thread: extjs tree - iterate through all nodes

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    84
    Vote Rating
    0
      0  

    Default extjs tree - iterate through all nodes

    i have an extjs tree. I need to iterate through all the nodes in this tree. my tree have the structure
    rootnode
    --- node1
    ---child1
    ---child2
    ---node2
    I need to iterate through node1, child1, child2, node2 and childs of node2

    i have tried the code
    Code:
    var rootNode=Ext.getCmp('treepanel').getNodeById('rootnode');
     Ext.each(Ext.getCmp('treepanel').getRootNode().childNodes, function(node){
    if(node){
           if(indexGridName == node.attributes.defaultname) {rootNode.removeChild(node);}}//console.log(node.attributes.defaultname);});},
    this code works only if the tree structure is of the form
    rootnode
    --child1
    ---child2
    Can anybody help to resolve this

  2. #2
    Sencha User
    Join Date
    Apr 2011
    Posts
    84
    Vote Rating
    0
      0  

    Default

    Can anybody help please

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    56
    Vote Rating
    0
      0  

    Default

    Use rootnode.cascade

    http://dev.sencha.com/deploy/ext-3.3...a.Node-cascade

    Code:
      treepanel.root.cascade(function(n) { 
        ...  
      });

  4. #4
    Sencha User
    Join Date
    Aug 2011
    Posts
    56
    Vote Rating
    0
      0  

    Default

    err, wrong link. See the cascade method in TreeNode

    http://dev.sencha.com/deploy/ext-3.3....tree.TreeNode

  5. #5
    Sencha User
    Join Date
    Oct 2015
    Posts
    6
    Vote Rating
    0
      0  

    Default Iterarting through Tree nodes at all levels

    Quote Originally Posted by prajeesh_bs View Post
    Can anybody help please

    treeStore.each(function(record) {
    if (!record.get("leaf")) {


    record.cascadeBy(function(rec, idx) {
    if () {
    rec.set("input", true);
    ......
    }
    });


    } else
    if () {
    record.set("input", true);
    .........
    }


    });

  6. #6
    Sencha User
    Join Date
    Oct 2015
    Posts
    6
    Vote Rating
    0
      0  

    Default

    As only cascade is not supported in IE so replaced it by cascadeBy..

  7. #7
    Sencha User
    Join Date
    Aug 2011
    Posts
    56
    Vote Rating
    0
      1  

    Default

    Wow, took a little over 6 years to reply huh? That's one helluva back log you got there!

    If I remember right, the cascade function is on the *root* node, not on the tree store. So you gotta do something like TreeGrid.getRootNode().cascade ... Or something like that. I had to quit using Ext since they phucked up the goddamn price of the basic licenses. Made me look like an telling people you can but a 200$ license when they packaged it into the user kit for $5,000 or whatever the hell - even did a damn prototype app that ended up being useless. Fu.ck you Sencha! I really liked working in ExtJS, too bad your management would rather see die by the stupid license changes and price hiking then to keep it lowcost and available to everyone. es, your product was freaking awesome, and if you hadn't done the BSD -> GPL -> whatever the it is now, you guys would been *way* more popular, way to suck.

    And now they hiking the prices from 200$ to like $5,000 cuz they wanna milk it for all its worth while the few suckers like us still enjoy working in a full rich application framework. Now I have to work in lame ass Angular which does uh...data binding... And not mich else without 3rd party BS which never wants to be compatible with all the other NG-horse.

    ReactJS is kinda cool.tho...best replacement for Ext IMHO, since Ext is the new IE6 vendor lockin bullsh.it framework that nobody wants to use any more.

    It still almost brings a tear to me eye ;-/. Get out while youve still got some time!! The wound heals with time...

Posting Permissions

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