Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Todd Nelson on Apr 11, 2008 12:56
open dhtmlx forum
xTree loading & processing

I am loading a tree from dhtmlXTreeFromHTML(treeDiv) which is using <xmp><item .... /></xmp> data. I would ultimately like to 1) mark each item as 'required' somehow in the item xml, and 2) walk through the tree elements to perform work on the 'required' ones (ie. change the item image, maybe hide the checkbox, etc.)

Would you have a suggestion on how to approach this need? Thank you.
Answer posted by Support on Apr 14, 2008 01:37
First, you can define custom images or checkbox state directly in item tags, while such initialization it possible to use all tags|attributes from tree's XML ( please reffer to online documentation )
If you still want to do it by script, later, you can use userdata sections

<xmp>
    <item text="first"></item>
    <item text="second"><userdata name="required">true</userdata></item>
    <item text="third"></item>
</xmp>

and later in script

var z=(tree.getSubItems(0)).split(",")
for (var i=0; i<z.length; i++)
    if (tree.getUserData(z[i],"required"))
       do_something();