I am using jqGrid, I have the given xml that I want to map to jqGrid
<list> <com.abc.db.ConfigInfo> <cfgId>83</cfgId> <cfgName>test</cfgName> <cfgDesc>test</cfgDesc> <cfgType>test</cfgType> <fileName>csmclientbenz.xml</fileName> <absolutePath>../webapps/csm/files//1-105101/csmclientbenz.xml</absolutePath> <emailAddress> abhishek@abc.com </emailAddress> <projectId>1-105101</projectId> <hostname>benz</hostname> <createDate>2011-06-15 15:29:55.0 IST</createDate> <updateDate>2011-06-15 15:29:55.0 IST</updateDate> <state>1</state> <productId>1</productId> </com.abc.db.ConfigInfo> <com.abc.db.ConfigInfo> <cfgId>102</cfgId> <cfgName>cfgname1</cfgName> <cfgDesc>test</cfgDesc> <cfgType>test</cfgType> <fileName>csmclientestilo.xml</fileName> <absolutePath>../webapps/csm/files//1-105101/csmclientestilo.xml</absolutePath> <emailAddress> abhishek@abc.com </emailAddress> <projectId>1-105101</projectId> <hostname>estilo</hostname> <createDate>2011-06-20 18:26:03.0 IST</createDate> <updateDate>2011-06-20 18:26:03.0 IST</updateDate> <state>1</state> <productId>1</productId> </com.abc.db.ConfigInfo> </list>
I used something like this, but please help me go from here, how can I assign xml that comes from XMLHttpRequest to jqGrid
var xml=client.responseText; $('#configDiv').empty(); $('<div width="100%">') .attr('id','configDetailsGrid') .html('<table id="list1" width="100%"></table>'+ '<div id="gridpager"></div>'+ '</div>') .appendTo('#configDiv'); jQuery("#list1").jqGrid({ datatype: "clientSide", height: 250, colNames:['cfgId','cfgName', 'cfgDesc', 'cfgType','absolutePath', 'updateDate', 'fileName'], colModel:[ {name:'cfgId',index:'cfgId', width:90, align:"right"}, {name:'cfgName',index:'cfgName', width:90, align:"right"}, {name:'cfgDesc',index:'cfgDesc', width:90, align:"right"}, {name:'cfgType',index:'cfgType', width:90, align:"right"}, {name:'absolutePath',index:'absolutePath', width:90, align:"right"}, {name:'updateDate',index:'updateDate', width:90, align:"right"}, {name:'fileName',index:'fileName', width:90, align:"right"}, ], pagination:true, pager : '#gridpager', rowNum:10, scrollOffset:0, height: 'auto', autowidth:true, viewrecords: true, gridview: true, xmlReader: { root : "list", row: "com.abc.db.ConfigInfo", repeatitems: false, id: "ASIN" }, edit:false, add:false, del:false });
Later I also need to hide cfgid and filename . Thanks please help