1

I'm using filteredData = $(grid).jqGrid('getGridParam', 'lastSelected') to get data for exporting on jqGrid. It works fine. But there is an issue in special case.

Example: I make some filtering to make sure that my grid has only one record. Then I delete that record and export grid. My expectation is that an error message is displayed because there is no any record on grid. But grid is still export with the single record above. I guess it occurs because filteredData is fetched right at moment which I make filtering, before deleting data. So the filteredData still has value when I export after deleting record.

I'm trying to find a walk-around solution for this issue. Is there any way to solve it ?

Please give me any suggestion if you met this problem before. Thanks in advance.

1 Answers1

0

You answered almost yourself on your question. The lastSelected which I described in the answer exactly like lastSelectedData parameter of free jqGrid get you copy of the SELECT results of local data based on the current filter and sorting. The copy will be not modified of cause. You have to make the same modification (delete the row) if you need to get the modified data. The exact implementation depends on how you use deleting of rows.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Do you mean that I also have to delete the row of filteredData in method which handling the deletion of my grid ? If so, it may be complex to handle that. Because I can delete or edit multi rows after filtering and before exporting. Additionally, I don't know how to make those modification for filteredData. Would you please give an example ? Thanks you very much for spent time on my question. – Khoa Nguyen Jun 02 '15 at 07:01
  • @KhoaNguyenHoangAnh: I can answer on your questions if you provide more information what you do and **which fork of jqGrid and in version of jqGrid you use?**. It's important to know **how you delete the data in the grid?** Do you call `delRowData` or `delGridRow` *directly* or you use `navGrid`, `inlineNav`, `formatter: "actions"` and so on? Do you use `multiselect: true`? – Oleg Jun 02 '15 at 07:08
  • I'm really sorry for replying late. I'm using jqGrid version 4.5.3. I don't use `multiselect` for my grid (`multiselect: false`). I use `navGrid` to delete the rows on local data and send those rows to server though a ajax method. – Khoa Nguyen Jun 02 '15 at 10:40