DHTMLX Docs & Samples Explorer

Lock tree

You can deny collapsing/exanding any node in the tree. To test this functionality click on an appropriate action link.



Source
 
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxtree.js"></script>
<script  src="../../codebase/ext/dhtmlxtree_li.js"></script>
<table>
    <tr>
        <td>
            <div id="treeboxbox_tree" style="width:250px; height:218px; background-color:#f5f5f5;border :1px solid Silver; overflow:hidden; "/>
        </td>
        <td rowspan="2" style="padding-left:25" valign="top">
        <div>
        <a  href="javascript:void(0)" onClick="tree.lockTree(true);">Lock tree</a></div>
        <div>
        <a  href="javascript:void(0)" onClick="tree.lockTree(false);">UnLock tree</a></div>
         <div>
        <a  href="javascript:void(0)" onClick="tree.lockItem(tree.getSelectedItemId(),true)">Lock item</a></div>
        <div>
        <a  href="javascript:void(0)" onClick="tree.lockItem(tree.getSelectedItemId(),false)">UnLock item</a></div>
        <div>
        <a  href="javascript:void(0)" onClick="alert(tree.isLocked(tree.getSelectedItemId()))">Get lock state</a></div>
        </td>
    </tr>
</table>
<script>
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/csh_bluebooks/");
tree.enableDragAndDrop(true);
tree.setLockedIcons("close2.gif", "close2.gif", "close2.gif");
tree.loadXML("../common/tree_lc.xml");
</script> <br><br> <div id="out_zone"></div>