简体   繁体   English

jqgrid导出到excel提供了不正确的数据

[英]jqgrid export to excel is giving incorrect data

I have custom button to filer the jqgrid. 我有自定义按钮来过滤jqgrid。 Onpage load grid gives me 100 records. 页面加载网格给了我100条记录。 If I export to excel I got 100 records correctly. 如果我导出到excel,我将正确获得100条记录。 Then I filter the jqgrid and grid shows me 10 records. 然后我过滤了jqgrid,网格显示了10条记录。 But if I export to excel I got 100 records which I got previously. 但是,如果我导出到excel,则会得到100条以前获得的记录。

Below is my code for filter. 下面是我的过滤器代码。

$("#grid").jqGrid('setGridParam', {
    search: true,
    postData: {filters: filter},
    sortname: 'statusCode',
    sortorder: 'asc'
});

$("#grid").setGridParam({page:1}).trigger("reloadGrid");
var gridData = $("#grid").jqGrid('getGridParam','data');

In gridData I got 100 object each time irrespective of any filter. 在gridData中,无论是否使用任何过滤器,我每次都会得到100个对象。 I need only records to be export which are displayed in grid after filtration. 我只需要导出记录,这些记录将在过滤后显示在网格中。

Please suggest solution how I can get 10 records from grid. 请提出解决方案,我如何从网格中获取10条记录。

If you use free jqGrid then you can get the value of new lastSelectedData parameter instead of the value of data parameter. 如果使用免费的jqGrid,则可以获取新的lastSelectedData参数的值,而不是data参数的值。 See the first demo at the end of the readme. 请参阅自述文件末尾 的第一个演示 The most new features are described in the readme or in wiki . 自述文件或Wiki中描述了最新功能。

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

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