Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Lea on Jun 23, 2009 05:36
open dhtmlx forum
Different css class for different nodes

Is it possible to apply different css classes for the tree nodes depending on the value of their "userdata" attribute?
Answer posted by Alex (support) on Jun 23, 2009 06:20

Hello,

there is setItemStyle method. It allows to define style of an item- the third paramete is css string (not class name):

tree.setItemStyle(id,tree.getUserData(id,"css"));

But if use initialize the tree from xml, you can use the itemtext tag (PRO edition):

<item id="some_id"><itemtext><div class="class_name">text</div></itemtext></item>