Sample: dhtmlxGrid | Different XML formats | dhtmlxGrid main page |
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></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>mygrid = new dhtmlXGridObject('gridbox'); ... mygrid.xml.top="mytop"; mygrid.xml.row="./myrow"; mygrid.xml.cell="./mycell" mygrid.load("custom.xml","xml");
Grid supports two additional XML formats, which are based on column IDs:
"xmlA" format<script></script> XML: <rows> <row id="r1" first="index is 1" second="altermative xml format" third="xmlA" /> ... </rows>... mygrid.setColumnIds("first,second,third") /*loading in "xmlA" format*/ mygrid.load("xmlA.php","xmlA");
<script></script> XML: <rows> <row id="r1"> <first>index is 1</first> <second>altermative xml format</second> <third>xmlB</third> </row> ... </rows>... mygrid.setColumnIds("first,second,third") /*loading in "xmlB" format*/ mygrid.load("xmlB.php","xmlB");
© DHTMLX LTD. All rights reserved |