Simple DHTMLXTree/User Data question

Hi,

Is there a way to retrieve all user data from a node in a tree?

I have a tree with nodes containing multiple user data elements, as:

<item text=“Test” id=“xyz” …>
val1
val1
val1
val1

Is there a way to retrieve all the userdata elements node by node so in the example, get key1, key2, key3 etc?

Thanks,
Assad

Hello,

there is not a public method to get all user data of a certain tree node. However, you can put additional userdata tag that will contains the names of other userdata:

<item text=“Test” id=“xyz” …>
key1,key2,key3,key4
val1
val1
val1
val1

var keys= tree.getUserData(“xyz”, “keys”);
if(keys){
var arr = keys.split(",");
for(var i=0; i < arr.length; i++){

}
}

why are the most simplest ideas usually the best … :smiley:

thanks Alexandra

You are welcome )