简体   繁体   English

jqgrid导出不导出正确的数据

[英]jqgrid export not exporting right data

when I export jqgrid to excel, I am not getting expected result.当我将 jqgrid 导出到 excel 时,我没有得到预期的结果。 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.我正在为其他 jqgrid 使用相同的导出功能,我在那里得到了正确的输出。 I don't understand why I am getting this kind of result for this jqgird.我不明白为什么我会为这个 jqgird 得到这种结果。 I already spent more than 2 days on this but can't output right result.我已经花了超过 2 天的时间,但无法输出正确的结果。 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"/>

在此处输入图片说明

There was some issues on export js function , export js function was setting colmodels manually with different names so I was getting undefined.导出 js 函数存在一些问题,导出 js 函数使用不同的名称手动设置 colmodels,所以我变得未定义。 I have fixed this issue我已经解决了这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM