Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Randall on Oct 28, 2008 13:31
open dhtmlx forum
Changing an Icon based on what it is

I am using the loadXML property, to dynamically add items to my tree based on items in a database. I would like each level that loads to have an icon based on what that item is (instead of where it is in the tree).

In the code that creates the XML i know what type of item i am adding, but have not found a way to identify an image with that item.

any ideas?
Answer posted by Support on Oct 29, 2008 06:12
You can set item's images directly in the xml. It can be done using following attributes:

  • im0 - image for node without children (tree will get images from the path specified in setImagePath(url) method)
  • im1 - image for opened node with children
  • im2 - image for closed node with children

  • <item im0="..." im1="..." im2="..." id=".." text="..." ...>
    ...
    </item>