Sample: dhtmlxTree Context menu and complex drag-and-drop dhtmlxTree main page
X

Right click on tree node. Drag and drop tree items within one tree or between trees. Complex drag-n-drop allows you to reorder tree nodes within one level and at the same time supports drop as child behavior.

 
<div id="treeboxbox_tree" style="width:200;height:200"></div>
<script>
 
    //init menu
            aMenu=new dhtmlXContextMenuObject('120',0,"../../../dhtmlxMenu/codebase/imgs/");
            aMenu.menu.loadXML("menu/_context.xml");                
            aMenu.setContextMenuHandler(onButtonClick);
 
    //init tree
            tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
            tree.setImagePath("../imgs/");
            tree.enableDragAndDrop(true);
            tree.enableContextMenu(aMenu); //link context menu to tree
            tree.loadXML("tree3.xml")
</script>