How to add different icons for nodes in dhtmlx tree?

Hi,

Can someone help me with this problem.
I want to add a different node icon (FolderClosed,FolderOpen and Leaf node) for each set of nodes I am adding to the tree. Suppose if I am adding nodes for employee it will have “E” icon. If I am adding project nodes, it will have “P” icon.

Please let me know if this is possible in dhtmlx tree. If so, then please guide me.

Regards,
Kavitha

I think the setItemImage2 function is what you’re looking for.

Have a look at this page: http://docs.dhtmlx.com/doku.php?id=dhtmlxtree:setting_tree_appearance

But that does not work for me. Whenever I add a new item to the tree how will I know what is the item id to be inserted?

Hi
I made a demo for you. I hope it will help you. See the attachment.
tree_icons.rar (51 KB)
One more thing: then you add a node, you use methods insertNewNext() or insertNewChild(). Please, read about them here:
docs.dhtmlx.com/doku.php?id=dhtm … ertnewnext
docs.dhtmlx.com/doku.php?id=dhtm … rtnewchild
There is a description of ‘image1’, ‘image2’ & ‘image3’ parameters.