Alan Mosley
Top achievements
Rank 1
Alan Mosley
asked on 20 May 2015, 11:12 AM
I just tried the excel export with custom binding, of cause I knew it would not get all data with custom binding, it only gets the current page.
I can get the data myself if I could get the filter info, how to get filter info when using excel export?
Thanks
9 Answers, 1 is accepted
0
Hello Alan,
The excel exporting will hit the Read() method of the grid's data source. If you set the AllPages option to true this will export all pages:
@(Html.Kendo().Grid()
.Excel(excel => excel.AllPages(true))
)
Regards,
Atanas Korchev
Telerik
The excel exporting will hit the Read() method of the grid's data source. If you set the AllPages option to true this will export all pages:
@(Html.Kendo().Grid()
.Excel(excel => excel.AllPages(true))
)
Regards,
Atanas Korchev
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Alan Mosley
Top achievements
Rank 1
answered on 22 May 2015, 07:20 AM
I am using custom binding, so it only outputs the page that is visible.
0
Hi Alan,
If you return only one page then the grid can't export all pages. You should check what the PageSize property of the DataSourceRequest parameter is and return the same amount of items. The grid will set the PageSize to the total number of items when exporting all pages.
Regards,
Atanas Korchev
Telerik
If you return only one page then the grid can't export all pages. You should check what the PageSize property of the DataSourceRequest parameter is and return the same amount of items. The grid will set the PageSize to the total number of items when exporting all pages.
Regards,
Atanas Korchev
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Alan Mosley
Top achievements
Rank 1
answered on 25 May 2015, 10:02 AM
That's would mean returning and rendering thousands of records, and if the user wants to sort or filter them before exporting that would be quite a bit of overhead.
What I have done is save the DataSourceRequest in a session object and then use that in the export controller to get correct data, but I thought there would be a better way of getting that data in the export controller, eg: the export request sending filter and sort data to the controller. The workaround will do unless you can suggest a more elgant way of doing this, thanks
What I have done is save the DataSourceRequest in a session object and then use that in the export controller to get correct data, but I thought there would be a better way of getting that data in the export controller, eg: the export request sending filter and sort data to the controller. The workaround will do unless you can suggest a more elgant way of doing this, thanks
0
Hello Alan,
If you want to export all data you have to return it to the grid. If you want to apply some filter - you can distinguish the export read request by checking the PageSize of the DataSourceRequest parameter.
Regards,
Atanas Korchev
Telerik
If you want to export all data you have to return it to the grid. If you want to apply some filter - you can distinguish the export read request by checking the PageSize of the DataSourceRequest parameter.
Regards,
Atanas Korchev
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Alan Mosley
Top achievements
Rank 1
answered on 25 May 2015, 01:26 PM
sorry I don't follow you. what do you mean by "distinguish the export read
request"
when exporting is the DataSourceRequest parameter sent to the server?
Thanks
0
Hi Alan,
Yes, the grid will make a Read request in the case of Excel export and set the PageSize to the total number of items if you have set AllPages to true.
Regards,
Atanas Korchev
Telerik
Yes, the grid will make a Read request in the case of Excel export and set the PageSize to the total number of items if you have set AllPages to true.
Regards,
Atanas Korchev
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Alan Mosley
Top achievements
Rank 1
answered on 25 May 2015, 05:35 PM
Just to make things clear, is the filter and sort info also sent? thanks
0
Alan Mosley
Top achievements
Rank 1
answered on 26 May 2015, 04:40 AM
Thanks, I am understanding better now, I did not realize that that both the read and export controllers were called, I was looking for DataSourceRequest object on export controller.
Thanks all seems to be working fine now