<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxtree.js"></script>
<script>function fixImage(id) {
switch (tree.getLevel(id)) {
case 1:
;
tree.setItemImage2(id, 'folderClosed.gif', 'folderOpen.gif', 'folderClosed.gif');
break;
case 2:
;
tree.setItemImage2(id, 'folderClosed.gif', 'folderOpen.gif', 'folderClosed.gif');
break;
case 3:
;
tree.setItemImage2(id, 'folderClosed.gif', 'folderOpen.gif', 'folderClosed.gif');
break;
default:
;
tree.setItemImage2(id, 'leaf.gif', 'folderClosed.gif', 'folderOpen.gif');
break;
}
}
</script>
<table>
<tr>
<td valign="top">
<div id="treeboxbox_tree" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"></div>
</td>
<td rowspan="2" style="padding-left:25" valign="top">
<a href="javascript:void(0);" onClick="var d=new Date(); tree.insertNewItem(tree.getSelectedItemId(),d.valueOf(),document.getElementById('ed1').value,0,0,0,0,'SELECT'); fixImage(d.valueOf());">Insert new child item</a> Item label <input type="text" value="New item" id="ed1"><br><br>
<a href="javascript:void(0);" onClick="var d=new Date(); tree.insertNewNext(tree.getSelectedItemId(),d.valueOf(),document.getElementById('ed2').value,0,0,0,0,'SELECT'); fixImage(d.valueOf());">Insert new item next</a> Item label <input type="text" value="New item" id="ed2"><br><br>
<a href="javascript:void(0);" onClick="tree.deleteItem(tree.getSelectedItemId(),true);">Delete item</a><br><br>
</td>
</tr>
</table>
<li>zeros passed to the function for arguments 4-7 (function to call on select, images) mean the usage of default values for them</li>
<li>Last argument is a comma delimited string of the following possible value (upper case only):</li>
<li type="circle">SELECT - move selection to this node after inserting</li>
<li type="circle">CALL - call function on select</li>
<li type="circle">TOP - add node to the top position </li>
<li type="circle">CHILD - node has child items</li>
<li type="circle">CHECKED - checkbox is checked (if exists)</li>
<script>tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/csh_bluebooks/");
tree.loadXML("../common/tree3.xml");
</script>