我正在尝试使用下面的自定义xml ....我试图将它加载到dhtmlxgrid但它似乎没有加载
我附加了自定义xml文件?如何将自定义xml添加到dhtmlxgrid?
<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.xml.top = "Root";
mygrid.xml.row = "./AuditTrail";
mygrid.xml.cell="./Time";
mygrid.xml.cell="./UserID";
mygrid.xml.cell="./Type";
mygrid.xml.cell="./Description";
mygrid.xml.cell="./val0";
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.load("../common/audit.xml", "xml");
//mygrid.load("../common/custom.xml", "xml");
</script>
XML文件
<?xml version="1.0" encoding="UTF-8"?>
<Root>
<AuditTrail>
<Time>2012-01-10 09:27:30 (GMT-05:00)</Time>
<UserID>DX</UserID>
<Type>FY [REC]</Type>
<Description>Server: wamp</Description>
<val0>1</val0>
</AuditTrail>
<AuditTrail>
<Time>2012-01-10 09:27:30 (GMT-05:00)</Time>
<UserID>DX</UserID>
<Type>FY [REC]</Type>
<Description>Server:tomcat</Description>
<val0>1</val0>
</AuditTrail>
<AuditTrail>
<Time>2012-01-10 09:27:30 (GMT-05:00)</Time>
<UserID>DX</UserID>
<Type>FY [REC]</Type>
<Description>Server: apache</Description>
<val0>1</val0>
</AuditTrail>
/Root>
答案 0 :(得分:0)
您无法使用自定义XML。请参阅文档:http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:syntax_templates
答案 1 :(得分:0)
使用dhtmlxgrid v4 +,您可以使用自定义格式。方法如下: http://docs.dhtmlx.com/grid__data_formats.html#customdataformat