Hi Have an xml which I need to display in the Jqgrid. Can any one please help in getting this working. If i am missing any other settings in the code please let me know
My xml data :
<entry>
<properties xmlns="http://example.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<property>
<name>header1</name>
<value>value 1.1</value>
</property>
<property>
<name>Header2</name>
<url>http://localhost/locator.aspx</url>
<value>value 1.2 </value>
</property>
<property>
<name>header 3</name>
<value>value 1.3 </value>
</property>
</properties>
</entry>
<entry>
<properties xmlns="http://example.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<property>
<name>header1</name>
<value>value 2.1</value>
</property>
<property>
<name>Header2</name>
<url>http://localhost/locator.aspx</url>
<value>value 2.2 </value>
</property>
<property>
<name>header 3</name>
<value>value 2.3</value>
</property>
</properties>
</entry>
Binding JqGrid like below but not working
function loadXMLDoc(data)
{
$("#loadXMLData").jqGrid({
url: 'local',
datatype: "xml",
height: 'auto',
colModel: [
{ name:xmlmap: function (obj) {
return $(obj).attr('name');
}}
, width: 80, sorttype: 'int',
xmlmap: function (obj) {
return $(obj).attr('value');
}
],
xmlReader: {
root: "properties",
row: "property",
repeatitems: false
},
loadonce: true,
rowNum: 1000
});
I need the out put in below format
<table border=1>
<tr>
<th>
header 1
</th>
<th>
header 2
</th>
<th>
header 3
</th>
</tr>
<tr>
<td>value 1.1</td>
<td>value 1.2</td>
<td>value 1.3</td>
</tr>
<tr>
<td>value 2.1</td>
<td>value 2.2</td>
<td>value 2.3</td>
</tr>
<tr>
<td>value 3.1</td>
<td>value 3.2</td>
<td>value 3.3</td>
</tr>
</table>