DHTMLX Docs & Samples Explorer

Different XML formats

The default xml format has the following tags: <rows> as a top, <row> to define rows and <cell> to set cells inside specified row. But tag names can be changed like in the sample presented below.

Grid supports two additional XML formats, which are based on column IDs:

"xmlA" format Reload grid from xml file in xmlA format

"xmlB" format Reload grid from xml file in xmlB format
Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxgrid.js"></script>        
<script  src="../../codebase/dhtmlxgridcell.js"></script>        
<script  src="../../codebase/ext/dhtmlxgrid_data.js"></script>    
<script  src="../../codebase/ext/dhtmlxgrid_data.js"></script>
 
 
 
<div id="gridbox" style="width:500px; height:270px; background-color:white;"></div>
 
<b>"xmlA"</b> format
<a href="javascript:void(0)" onclick="mygrid.xml.top='rows';mygrid.xml.row='./row';mygrid.clearAll();mygrid.load('php/xmlA.php','xmlA');">Reload grid from xml file in xmlA format</a><br/>
<br/>
<b>"xmlB"</b> format
 
<a href="javascript:void(0)" onclick="mygrid.xml.top='rows';mygrid.xml.row='./row';mygrid.clearAll();mygrid.load('php/xmlB.php','xmlB');">Reload grid from xml file in xmlB format</a>    
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setHeader("Column A, Column B,Column C");
mygrid.setInitWidths("80,200,*");
mygrid.setColAlign("right,left,left");
mygrid.setColTypes("dyn,ed,ed");
mygrid.setColSorting("int,str,str");
mygrid.setColumnIds("first,second,third");
mygrid.xml.top = "mytop";
mygrid.xml.row = "./myrow";
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.load("../common/custom.xml", "xml");
</script>