DHTMLX Docs & Samples Explorer

Drag and Drop

This JavaScript tree menu has extended drag-and-drop functionality (within one tree, between trees, between frames). Drop-as-sibling behavior makes it easy to reorder nodes in a tree view. You can easily edit the tree by dragging nodes within one tree or between trees or even to another object.



Drag-and-Drop works in each tree and between trees too.

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 valign="top">
            <div id="treeboxbox_tree" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;overflow:hidden"></div><br>
            
        </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"></div><br>
 
        </td>
    </tr>
</table>
 
 
<script>
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
 
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/csh_yellowbooks/");
tree.enableDragAndDrop(true);
tree.loadXML("../common/tree_05_drag_n_drop.xml");
 
tree2 = new dhtmlXTreeObject("treeboxbox_tree2", "100%", "100%", 0);
 
tree2.setSkin('dhx_skyblue');
tree2.setImagePath("../../codebase/imgs/csh_yellowbooks/");
tree2.enableDragAndDrop(true);
tree2.loadXML("../common/tree_05_drag_n_drop.xml");
</script>