dhtmlxTree

hi,



im having quite a trouble with parsing through dhtmlxTree…



Is there a for each function similar to dhtmlxGrid in dhtmlxTree?



Else how can i go through each node in the tree…

and for each node, i need to retrieve ALL userdata associated to this node?



any help??





thanks,



j


Hello,


unfortunately, there is no “for each” method in tree. But tree provides another method to get all items:


var list = tree.getAllSubItems(0); /0 is root id/


var items = list.split(","); /array of all items/


for(var i=0; i < items.length; i++){


alert(tree.getUserData(items[i],name));


}

thanks for the reply

still have another problem,
how can i retrieve all the userdata or the array of userdata?

during the parsing i do not know yet which userdata exists, hence i donot know the specific name of the userdata. is there some sort of uesrdata[] that i can access which will provide me with the id-value (like a hastable) mapping??


thanks again!
j


There is an internal property - _userdatalist. It’s a list of userdata names for an item:


var node = tree._globalIdStorageFind(itemId,0,1); /item object/


var list = node._userdatalist; /list of names separated by commas/