Moving items

dhtmlxTree allows you to move any item in the tree using API.

Move selected Up | Down | Left

</> Source
<!DOCTYPE html>
<!--pro-->
<html>
<head>
	<title> Moving items</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"/>
	<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");
		}
		function trser(){
			var out = myTree.serializeTree();
			out = out.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\&lt\;item/g,"<br>&lt;item");
			document.getElementById("out_zone").innerHTML = out;
			document.getElementById("out_zone").style.display = "";
		}
	</script>
</head>
<body onload="doOnLoad()">
	<h1>Moving items</h1>
	<p>dhtmlxTree allows you to move any item in the tree using API.</p>
	<table>
		<tr>
			<td>
				<div id="treeboxbox_tree" class="tree_demo_samples"></div>
			</td>
			<td rowspan="2" style="padding-left:25px" valign="top">
				Move selected <a href="javascript:void(0)" onClick="myTree.moveItem(myTree.getSelectedItemId(),'up')"> Up </a> | <a href="javascript:void(0)" onClick="myTree.moveItem(myTree.getSelectedItemId(),'down')">Down</a> | <a href="javascript:void(0)" onClick="myTree.moveItem(myTree.getSelectedItemId(),'left')"> Left</a>
				<br/><div><a href="javascript:void(0)" onClick="trser();">Serialize</a></div>
			</td>
		</tr>
	</table>
	<br><div id="out_zone" style="display:none;width:550px;height:200px;overflow:auto;"></div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.