DHTMLX Docs & Samples Explorer

Complex Drag and Drop

Complex drag-n-drop enables both drop as sibling and drop as child behavior via the tree.setDragBehavior() method.



Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxtree.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 style="padding-left:25px" valign="top">
            <div id="treeboxbox_tree2" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;overflow:hidden;"/>
        </td>
    </tr>
</table>
 
<script>
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/csh_bluefolders/");
tree.enableDragAndDrop(true);
tree.enableSmartXMLParsing(true);
tree.setDragBehavior("complex");
tree.loadXML("../common/tree_a.xml");
tree2 = new dhtmlXTreeObject("treeboxbox_tree2", "100%", "100%", 0);
 
tree2.setSkin('dhx_skyblue');
tree2.setImagePath("../../codebase/imgs/csh_bluefolders/");
tree2.enableSmartXMLParsing(true);
tree2.enableDragAndDrop(true);
tree2.setDragBehavior("complex");
tree2.loadXML("../common/tree_a.xml");
</script> <br><br>