Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by josh on May 06, 2009 15:44
open dhtmlx forum
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
Answer posted by Alex (support) on May 07, 2009 01:42

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));

}

Answer posted by josh on May 07, 2009 08:31
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
Answer posted by Alex (support) on May 08, 2009 03:23

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*/