1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    16
    Vote Rating
    0
    fxlacroix is on a distinguished road

      0  

    Default populate a class to a node and all its children

    populate a class to a node and all its children


    Hi,

    actually playing with tree Panel, i would like to apply a class style to a parent node (not a root) with its children... example : change the icon just for a branch.

    for the case, i apply class to parent node (with getUI().addClass removeClass), and i browse each children to make the same...
    If the tree is complex, it is a bad method...

    any ideas ?

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,169
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Cascade is your friend.

  3. #3
    Ext User
    Join Date
    Feb 2008
    Posts
    16
    Vote Rating
    0
    fxlacroix is on a distinguished road

      0  

    Default yeah !

    yeah !


    thx for quick answer

  4. #4
    Ext User
    Join Date
    Feb 2008
    Posts
    16
    Vote Rating
    0
    fxlacroix is on a distinguished road

      0  

    Default good usage of cascade ?

    good usage of cascade ?


    hello,

    i got a parent node and i want to apply some operations upon all folder child of its hierarchie

    here is what i do

    node.cascade(function(node){
    if ( ! node.isLeaf() ){

    // some action here

    }
    }, node);

    my problem is that the console.log show me the same node at each time...

    good or bad use of cascade ?

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,169
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Bad use of variable naming.

    If you read the docs, the default scope of case is the current node:

    Code:
    node.cascade(function()
    {
       console.log(this.id);
    }
    );

  6. #6
    Ext User
    Join Date
    Feb 2008
    Posts
    16
    Vote Rating
    0
    fxlacroix is on a distinguished road

      0  

    Default remeciement

    remeciement


    thx full evant !

Thread Participants: 1