Kendo Angular Grid --> How to Export the entire records to excel instead of page level

1 Answer 906 Views
General Discussions
Sankar
Top achievements
Rank 1
Sankar asked on 17 Dec 2018, 10:29 AM

Hi Team,

 

Kendo Angular Grid --> How to Export the entire records to excel instead of page level

I have Kendo Angular gird and Export to Excel option as well, while doing export to excel it is download only current page not entire records.

Can you please guide me how to download export to excel with entire records?

 

Note: if I select page size manually to 1000 (example) download all the records, here our requirement is while clicking on Export to excel itself download all records.

Thanks,

Sankar

 

1 Answer, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 17 Dec 2018, 11:53 AM
Hi Sankar,

To export a data set that is different than the one, currently displayed in the Grid (after paging, filtering, etc. are applied), you can utilize the fetchData callback as described in the following section of our documentation and the auxiliary runnable demos:

https://www.telerik.com/kendo-angular-ui/components/grid/export/excel-export/#toc-exporting-specific-data

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Dimitris
Top achievements
Rank 1
Veteran
commented on 20 Nov 2020, 11:13 AM

How can we select which columns / fields to export?
I cannot find such an option on process.
Martin
Telerik team
commented on 20 Nov 2020, 11:50 AM

Hello Dmitris,

To export only selected rows in excel, please take a look at this forum thread.

https://www.telerik.com/forums/kendo-grid---export-into-excel-only-selected-rows

Regards,
Martin
Progress 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/.

Dimitris
Top achievements
Rank 1
Veteran
commented on 20 Nov 2020, 02:50 PM

Thanks Martin

I've already did check that and implement it, but the problem with that is that you declare which columns you want to display on the exported file and not just those that are not hidden by the user.
In my case I have an action column in the begining of the grid with EDIT, VIEW, DELETE icons and of course I don't want to show that one on the PDF and Excel exports.
How can I only exclude this one but for all the others columns to follow what the user has selected as visible and hidden?
I tried adding only my actions column with attribute hidden = true but like this it was exporting an empty PDF.

And my other problem is that I am building the columns in the component because I followed another of your examples for persistent filters, sorting etc (which btw has a bug on column reordering when we have hidden columns), so I had to remove everything from the HTML to the component.

 

Thanks

Martin
Telerik team
commented on 23 Nov 2020, 10:21 AM

Hello Dimitris,

By default, the grid exports its current columns. In order to include or exclude columns in the exported excel file, the developer can customize the exported columns by defining them between the  <kendo-grid-excel> tags e.g.:

 <kendo-grid-excel fileName="Products.xlsx">
                <kendo-excelexport-column field="ProductName" title="Product Name">
                </kendo-excelexport-column>
                <kendo-excelexport-column field="Category.CategoryName" title="Category">
                </kendo-excelexport-column>
</kendo-grid-excel>

https://www.telerik.com/kendo-angular-ui/components/grid/export/excel-export/#customizing-exported-columns

I hope this helps.

Regards,


Martin
Progress 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/.

Dimitris
Top achievements
Rank 1
Veteran
commented on 24 Nov 2020, 05:11 PM

Thanks Martin,

but when you define them like this, it ignores which columns are hidden and which are visible by the user.
What I need is what it does by default excluding the ACTIONS column with the add, edit, view etc buttons.
All the rest columns should be whaterver the user selected.

Martin
Telerik team
commented on 26 Nov 2020, 10:32 AM

Hi Dimitris,

The developer can iterate a column configuration object in  <kendo-excelexport-column> component directly e.g.:

      <kendo-grid-excel fileName="Products.xlsx">
        <kendo-excelexport-column
          *ngFor="let column of columnsConfig"
          [field]="column.field"
          [title]="column.title"
          [hidden]="column.hidden"
        >
        </kendo-excelexport-column>

When columns are hidden dynamically, in columnVisibilityChange handler, the respective hidden property from the column config array can be updated.

Regards,
Martin
Progress 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/.

Tags
General Discussions
Asked by
Sankar
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Share this question
or