Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Yves on Apr 13, 2008 05:58
open dhtmlx forum
DHTMLXTree: Item's text features

I know for instance that I can set the color of an item by code or by adding necessary html tags in the source xml file;

The problem with the first approach is that when I make such modifications onXLE (the first point in time when I can play with tree's items), the items first appear as they are by default (black text) and only then shortly after change. The latency time is very small but not immediate.

The problem with the second approach is purely conceptual and also practical... Once I feed the tree with html loaded text values I can hardly change them later. And also, it is just incorrect in my opinion to add such business-unrelated overhead to the source xml.

How can I do it otherwise? Also... Is there a way to play with fonts, colours, text style (bold, italic...) by using the tree's API?


Thx
Answer posted by Support on Apr 14, 2008 02:50
>>How can I do it otherwise?
The color of item can be set as part of XML structure , in such case it will be applied to item during item creation.

     <item id="p8" text="some text" aCol="red" sCol="green" />

aCol - color of item in normal state
sCol - color of item in selected state

>>
Is there a way to play with fonts, colours, text style (bold, italic...) by using the tree's API
    You can use
       tree.setItemStyle(id,"any css styles here")
       tree.setItemStyle(id,"font-weight:bold; background-color:red;")