Loading from JSArray

There is a possibility to load data from JS Array. You can load data from an array object or a file.

reload from JS array (textarea)
load from external JS array data file

Format of JS array.
Tree item is represented with three values as sub-arrays of the top array - id, parent_id, text. The order of rows in JS array doesn't matter.

</> Source
<!DOCTYPE html>
<!--pro-->
<html>
<head>
	<title>Loading from JSArray</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.parse([[1,0,"1111"], [2,0,"2222"], [3,0,"3333"], [4,2,"child"]], "jsarray");
		}
	</script>
</head>
<body onload="doOnLoad()">
	<h1>Loading from JSArray</h1>
	<p>There is a possibility to load data from JS Array. You can load data from an array object or a file.</p>
	<table>
		<tr>
			<td>
				<div id="treeboxbox_tree" class="tree_demo_samples" style="height:200px;"></div>
			</td>
			<td rowspan="2" style="padding-left:25px" valign="top">
				<a href="javascript:void(0)" onClick="myTree.deleteChildItems(0); eval('var z='+document.getElementById('a12').value); myTree.loadJSArray(z);"> reload from JS array (textarea) </a><br/>
				<a href="javascript:void(0)" onClick="myTree.deleteChildItems(0); myTree.loadJSArrayFile('../common/data.js');"> load from external JS array data file </a>
			</td>
		</tr>
	</table>
	<textarea id="a12" rows="8" cols="40" style="width:250px;">[[1,0,"1111"],[2,0,"2222"],[3,0,"3333"],[4,2,"child"]]</textarea>
	<p>Format of JS array.<br>
		Tree item is represented with three values as sub-arrays of the top array - id, parent_id, text.
		The order of rows in JS array doesn't matter.</p>
</body>
</html>

Documentation

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