Hello--
$.ig.GridExcelExporter.export($("#grid"));
This works great and downloads the Excel file. I'm noticing, however, that data is missing from any rows that aren't on the currently displayed page. I can see every row, but not all of the cell values are filled in.
If I have 30 rows and I'm on page 1 with 25 per page, I will see 30 total rows. The first 25 show up perfectly but the last 5 only show the data in the cells which don't have formatters attached to the column.
Is there a way around this?
Thanks
Hello Alex,
I am currently working onto this issue to figure it out and will update you with my findings.
Hi,
I am sharing this workaround, which involves handling the cellExported client side event so that every community member can use it until this behavior is fixed in the next service release.
Basically, if a cell which display text uses the formatter function has just been exported we find the proper value and manually write it to the corresponding excel cell. Please see the attached sample for reference and let me know if you have any further questions on the matter.
cellExported: function (sender, args) { if(args.columnKey == "ObjectCol" && args.xlRow.index() > 0) { var gridRowIndex = args.xlRow.index() - 1; var currentPage = $("#grid").igGridPaging("pageIndex") + 1; var pageSize = $("#grid").igGridPaging("pageSize");
if ((currentPage == 1 && gridRowIndex >= pageSize) || ((gridRowIndex < ((pageSize * currentPage) - pageSize) || gridRowIndex >= (pageSize * currentPage)))) { var dataRow = $("#grid").igGrid().data("igGrid").dataSource._data[gridRowIndex]; // this is the current row corresponding record from the dataSource var cellValue = $("#grid").igGrid("option", "columns")[args.columnIndex].formatter(dataRow.ObjectCol); // this is the formatted cell text args.xlRow.setCellValue(args.columnIndex, cellValue); // write this value to the corresponding cell in the excel worksheet } } }