Excel export all pages but keeping applied filter

1 Answer 52 Views
Excel Export Grid
Ricky
Top achievements
Rank 1
Iron
Ricky asked on 20 Jan 2022, 12:38 PM

Hi, 

I have an Excel and PDF export over my grid using the following:

<ExcelExport data={data} ref={_export}>{grid}</ExcelExport>
<GridPDFExport ref={(pdfExport) => (gridPDFExport = pdfExport)}>
{grid}
</GridPDFExport>

I have a multiple page grid and all pages export. However if I apply a sort to the grid and export, the sort does not retain on the export. If I instead use dataResult.data (which has the sorted order), it only shows the first page.

How do I export all pages but retain the sort, column order etc?

1 Answer, 1 is accepted

Sort by
0
Filip
Telerik team
answered on 21 Jan 2022, 02:01 PM

Hello, Ricky,

This can be achieved by creating a third collection that contains only the sorted items and passing it to the save function like shown in this example:

https://stackblitz.com/edit/react-qkxqck-bcdofo?file=app/main.jsx

I  hope this helps.

Regards,FilipProgress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Ricky
Top achievements
Rank 1
Iron
commented on 21 Jan 2022, 03:12 PM

Hi, sorry I don't quite understand how I retain the original sort with this. For example, in your provided example, if I sort by name in reverse alphabetical order, I could manually sort the collection like that myself. But how do I take the existing sort and reflect that? Do I need to pull it from the data state (the sort, field and direction) and apply that to the collection myself or is there an easier way?
Filip
Telerik team
commented on 24 Jan 2022, 10:03 AM

Hi, Ricky,

The sorted data can be obtained by passing e.data to a variable that is being kept in the state, however, this will only export the sorted data for that particular page instead of the entire sorted data.

Currently, the way to export the entire sorted data is to create a third collection, sort the items and pass that to the save function.

Regards, FilipProgress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Excel Export Grid
Asked by
Ricky
Top achievements
Rank 1
Iron
Answers by
Filip
Telerik team
Share this question
or