1. #1
    Ext User
    Join Date
    Sep 2009
    Posts
    17
    Vote Rating
    0
    denizkaan is on a distinguished road

      0  

    Post How to render different icons for the tree nodes according to the depth of nodes?

    Hi,

    I have a tree to display, which is populated using a loader. This tree has maximum depth of three, such that, any node can be a root node (the only level-0 node), or a level-1 node (that is the child of the root node), or level-2 node (that is child of any level-1 node). My problem is that, I would like nodes to have one of the three icons according to their level. Can somebody help me? Any suggestion is appreciated.

    Suppose that I have defined icon classes in some css. I do not want to supply cls attribute in JSON. Maybe some code like this may help me:

    tree.on('load', function(node)
    { var children = node.childNodes;
    for (var i = 0; i < children.length; i++)
    {
    var n = children[i];

    // change icon based on level.
    // what code here ???
    // ....
    // ....
    }
    }, this);


    Thank you!
    Last edited by denizkaan; 23 Sep 2009 at 6:06 AM. Reason: typo

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    84
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default

    why do it on the client side!? do it on the server side!

Thread Participants: 1