Sample: dhtmlxGrid Different XML formats dhtmlxGrid main page
X

The default xml format has 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.

 
<div id="gridbox" width="100%" height="250px" style="background-color:white;overflow:hidden"></div>
<script>
 
    mygrid = new dhtmlXGridObject('gridbox');
    ...
    mygrid.xml.top="mytop";
    mygrid.xml.row="./myrow";
    mygrid.xml.cell="./mycell"
    mygrid.load("custom.xml","xml");
</script> XML: <?xml version="1.0" encoding="utf-8"?> <mytop> <myrow id="1"> <mycell>500</mycell> <mycell>Time to Kill</mycell> <mycell>John Grisham</mycell> </myrow> ... </mytop>

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

"xmlA" format
 
<script>
    
    ...
    mygrid.setColumnIds("first,second,third")
    
    /*loading in "xmlA" format*/
    mygrid.load("xmlA.php","xmlA");
</script> XML: <rows> <row id="r1" first="index is 1" second="altermative xml format" third="xmlA" /> ... </rows>
Reload grid from xml file in xmlA format

"xmlB" format
 
<script>
 
    ...
    mygrid.setColumnIds("first,second,third")
    /*loading in "xmlB" format*/
    mygrid.load("xmlB.php","xmlB");
</script> XML: <rows> <row id="r1"> <first>index is 1</first> <second>altermative xml format</second> <third>xmlB</third> </row> ... </rows>
Reload grid from xml file in xmlB format