Dhtmlx tree on load set image

Hi,



I want to change the image icons for all nodes when the tree loads according to the level. I tried setOnOpenHandler but it changes only while opening a node. Is there any way to loop over all nodes & setItemImage2 over all ids on load? I hope I am clear.



Thanks a lot.

You can use onXLE event, which provides id, for which XML was loaded

tree.attachEvent(“onXLE”,function(a,id){
var ids = tree.getSubItems(id).split(",")
for ( var i=0; i< ids.length; i++)
tree.setItemImage2(ids[i], some_image);
})