when I export jqgrid to excel, I am not getting expected result. I am getting right data for two columns and for the rest columns it says undefined, also I am getting two extra columns at the end (please see the attached pic). I am using same export function for other jqgrid and I am getting right output there. I don't understand why I am getting this kind of result for this jqgird. I already spent more than 2 days on this but can't output right result. Any help will be highly appreciated.
$("#dataTable").jqGrid({
url: '/test/getAllData.html',
datatype: "json",
colNames: ['id', 'Material name', 'Unit', 'Supplier', 'Date', 'Amount'],
colModel: [
{ name: 'id', index: 'id',width: 300 },
{ name: 'MaterialName', index: 'MaterialName', width: 300 },,
{ name: 'unit', index: 'unit', width: 300 },
{ name: 'supplier', index: 'supplier', width: 300 },
{ name: 'date', index: 'date', width: 300 },
{ name: 'amount', index: 'amount', width: 300 }
],
rowNum: 100,
rowList: [25, 50, 75, 100],
pager: '#dataTablePager',
viewrecords: true,
ignoreCase: true,
loadonce: false,
viewrecords: true,
jsoonReader: {
repeatitems:false;
},
loadComplete : function () {
exportToExcel("dataTable"); //export function
}
});
<div id="dataTable"/></div id="dataTablePager"/>