my xml like this: test.xml
<?xml version="1.0" encoding="utf-8"?>
<root>
<R c="0" n="a"/>
<R c="1" n="b"/>
<R c="2" n="c"/>
</root>
how can bind to jqGrid? i tried like this:
jQuery("#ourunittb").jqGrid({
url: 'test.xml',
datatype: "xml",
height: 1000,
colNames: ['mycode, 'myname'],
colModel: [
{ width: 60, xmlmap: "root>R>c" },
{ width: 90, xmlmap: "root>R>n" }
],
xmlReader: {
root: "root",
row: "R",
repeatitems: false
},
rowNum: 1000,
autowidth: true
});
But I can’t get data. Please help me. Thanks very much
The current version of jqGrid supports functions inside of
xmlReaderandxmlmap(see my original feature request here). So you can modify your JavaScript code to the following:The results you can see on the demo:
I added
loadonce: trueoption and thesorttypeproperty to support local sorting in the loaded grid. In the same way you can use local paging and local filtering of the data (using toolbar searching or advanced searching)