Drag-n-drop into tree
Try to drag any element and drop it on the tree
Some text |
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Drag-n-drop into tree</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
<script src="../../../codebase/dhtmlx.js"></script>
<link rel="stylesheet" type="text/css" href="../common/demo_style.css"/>
<style>
div.alfa {
margin-top:10px;
margin-left:50px;
}
</style>
<script>
var myTree;
function doOnLoad(){
myTree = new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
myTree.setImagePath("../../../skins/web/imgs/dhxtree_web/");
myTree.enableDragAndDrop(true);
myTree.load("../common/tree.xml");
myTree.makeDragable("a0");
myTree.makeDragable("a1");
myTree.makeAllDraggable();
myTree.makeDragable("a2",function(drop_obj,source_id,target_on,target_before){
drop_obj.insertNewItem(target_on,source_id,"Green 1");
drop_obj.insertNewItem(target_on,source_id,"Green 2");
drop_obj.insertNewItem(target_on,source_id,"Green 3");
});
}
</script>
</head>
<body onload="doOnLoad()">
<h1>Drag-n-drop into tree</h1>
<p>Try to drag any element and drop it on the tree</p>
<table>
<tr>
<td>
<div id="treeboxbox_tree" class="tree_demo_samples"></div>
</td>
<td>
<div style="padding-left:50px;" onselectstart="return false;">
<div id="a0">Some text</div> <br/>
<div id="a1" text="Red" ><div style='width:50px; height:20px; background-color:red;'> </div></div> <br/>
<div id="a2" text="Green" ><div style='width:50px; height:20px; background-color:green;'> </div></div><br/>
<div dragInDhtmlXTree="true" id="a3" text="Blue" ><div style='width:50px; height:20px; background-color:blue;'> </div></div><br/>
</div>
</td>
</tr>
</table>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.