I am planning generate custom XML of the entire grid data for which i need to traverse through each row , and each cell of the grid.
It is easy to traverse through rows as follow. The only problem i am facing is traversing through the cells as getRowData returns key value pair instead of an array.
var ids = jQuery("#jgrid").jqGrid('getDataIDs');
//traverse the rows
for (var i = 0; i < ids.length; i++) {
var rowdata = $("#jgrid").getRowData(ids[i]);
var res = "";
// Traverse the cells which does not work
for (var j = 0; j < rowdata.length; j++) {
...
....logic to generate Xml element for each cell
}
}
I dont want to hardcode column names as i plan to use it for all the grids. So the solution has to be Generic.
Any ideas ? Thanks in Advance.