DHTMLX Docs & Samples Explorer

Setting Item Style on Fly

To set style of any string in the tree you should select a string, and then click on the action link.

Set item style
 


Source
<style>
.standartTreeImage img{
    width:0px;
}
</style>
 
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxtree.js"></script>    
<p>To set style of any string in the tree you should select a string, and then click on the action link.<p>
<table>
    <tr>
        <td valign="top">
            <div id="treeboxbox_tree" style="width:350px; height:218px;background-color:#f5f5f5;border :1px solid Silver;"></div>
        </td>
        <td rowspan="2" style="padding-left:25" valign="top">
        
        <a href="javascript:void(0);" onClick="tree.setItemStyle(tree.getSelectedItemId(),document.getElementById('tuds').value)">Set item style</a><br>
         <textarea id="tuds" rows="10" style="width:300px;">font-weight:bold;
text-decoration:underline;
         </textarea>
        </td>
    </tr>
    <tr>
        <td>&nbsp;</td>
    </tr>
</table>
<script>
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/");
tree.enableTreeImages("false");
tree.enableTreeLines("false");
tree.loadXML("../common/tree_ol.xml");
</script> <br><br>