TreeGrid serialization
Serialization for dhtmlxTreeGrid gives you actual state of the content in xml format.
Math formulas can be serialized as formulas or as values.
</> Source
<!DOCTYPE html>
<html>
<head>
<title>TreeGrid serialization</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>
<script>
var myTreeGrid;
function doOnLoad() {
myTreeGrid = new dhtmlXGridObject('gridbox');
myTreeGrid.setImagePath("../../../codebase/imgs/");
myTreeGrid.setIconPath("../common/images/");
myTreeGrid.setHeader("Title,Price,Quantity,Total");
myTreeGrid.setInitWidths("*,100,80,100");
myTreeGrid.setColAlign("left,right,right,right");
myTreeGrid.setColTypes("tree,price,ed[=sum],price[=sum]");
myTreeGrid.setColSorting("str,int,int,int");
myTreeGrid.setMathRound(2);
myTreeGrid.init();
myTreeGrid.load("../common/treegrid_sample_06_serialization.xml");
}
</script>
</head>
<body onload="doOnLoad();">
<h1>TreeGrid serialization</h1>
<p>Serialization for dhtmlxTreeGrid gives you actual state of the content in xml format.
<br>Math formulas can be serialized as formulas or as values.</p>
<table width="835">
<tr>
<td width="600px">
<div id="gridbox" width="100%" height="250px" style="background-color:white;"></div>
</td>
<td valign="top">
<textarea style='width:300px; height:230px;'></textarea><div><a href="#" onclick="this.parentNode.previousSibling.value=myTreeGrid.serialize()">Serialize TreeGrid</a></div>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<div><a href="#" onclick="myTreeGrid.deleteSelectedItem()">Delete selected rows</a></div>
<div><a href="#" onclick="myTreeGrid.addRowBefore((new Date()).valueOf(),['new row','text','text',1,0],myTreeGrid.getSelectedId())">addRowBefore selected rows</a></div>
<div><a href="#" onclick="myTreeGrid.addRowAfter((new Date()).valueOf(),['new row','text','text',1,0],myTreeGrid.getSelectedId())">addRowAfter selected rows</a></div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.