I found the following section regarding exporting large datasets from the Kendo Grid:
http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/excel-export#use-server-side-processing
We currently have this exact need, but I am unable to find any code giving an example of how to tie the grid data to the TDP library. The closest I can find relating to exporting with this library is http://docs.telerik.com/devtools/document-processing/libraries/radspreadstreamprocessing/export but the code samples are not closely related to my situation. Can you provide or point me to some code samples that show how to process a large data set from a Kendo grid?
Thank you.
9 Answers, 1 is accepted
I have already responded to the private support ticket, however, I will share my response here as well in case anyone else is looking for a sample implementation of a Kendo UI Grid with the RadSpreadProcessing library.
It is available at:
https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/grid-dpl-integration
Regards,
Alex
Telerik by Progress
Hi Alex Hajigeorgieva,
I am using kendo grid and I wanted to export that to excel. I have 80k records with 30 columns. So is it possible to export the data to excel. If yes could you share the demo piece of it. I am using visual studio 2015 with c# MVC platform. It is helpful if you share the demo on MVC.
Since the data is already available to you on the server, perhaps you may have a look at the Server Export demo at:
https://demos.telerik.com/aspnet-mvc/grid/server-export
If you look at the .cshtml file, the button click sends only the columns configuration to the backend:
$(
".download"
).click(
function
() {
var
grid = $(
"#Grid"
).data(
"kendoGrid"
);
$(
"#export-model"
).val(encodeURIComponent(JSON.stringify(grid.columns)));
});
Then, change tab and you will see that the columns received from the client are used to build the spreadsheet on the server and are parsed to a list of the ExportColumnSettings class:
var columnsData = JsonConvert.DeserializeObject<
IList
<ExportColumnSettings>>(HttpUtility.UrlDecode(model));
This is almost identical to the demo I referenced in my previous response, where the model is mapped to a custom class:
https://github.com/telerik/ui-for-aspnet-mvc-examples/blob/master/grid/grid-dpl-integration/GridExcelSpreadProcessing/Controllers/StreamController.cs#L20
var modelObject = JsonConvert.DeserializeObject<IList<ColumnSettings>>(model);
Both of the projects are available to you and both are runnable so you may debug them and put breakpoints where desired - the one in the repository is open to the public and the one in our online demos is part of our distribution:
// Controller:
~telerik.ui.for.aspnetmvc.[VERSION].commercial\wrappers\aspnetmvc\Examples\VS2015\Kendo.Mvc.Examples\Controllers\Grid\Server_ExportController.cs
// View:
~telerik.ui.for.aspnetmvc.[VERSION].commercial\wrappers\aspnetmvc\Examples\VS2015\Kendo.Mvc.Examples\Views\gridserver_export.cshtml
https://www.telerik.com/account/product-download?product=KENDOUIMVC
Regards,
Alex Hajigeorgieva
Progress Telerik
Hi Alex Hajigeorgieva,
Good Day, I hope you will consider my question in this thread.
I'm having the same problem with downloading xlsx file from kendo ui grid. I am using Kendo UI for JQuery. Is there a way to export large dataset from kendo grid using this library instead of using Kendo UI for MVC?
Current Code:
//this kendo Grid will return 100k + rows
$("#myTable").kendoGrid({
toolbar: ["excel"],
excel: {
fileName: "Trade Reports.xlsx",
filterable: true,
allPages: true,
},
Thank You,
You can use the same approach like in the MVC example for submitting the relevant information to the server. There, the excel file can be generated and returned to the client.
Also, you can specify a proxy in the excel export options. Specify the excel.proxyURL option to define the URL that will stream the file to the client-side. Then set the excel.forceProxy option to make sure that the proxy is always used.
Regards,
Viktor Tachev
Progress Telerik
Hi Viktor,
Thank you for your suggestion. I only solved the problem by processing the creation of the Excel file after processing the data to be displayed in the Kendo Grid. I also created a separate function that will fetch that file from the server and download it client-side via FileResult View in MVC. I appreciated your answer.
Regards,
Angelo
I am glad that you have the functionality up and running. Thank you for sharing your approach with the community.
Regards,
Viktor Tachev
Progress Telerik
Hello Pankaj,
Would you share a sample project where the behavior you are seeing is replicated? This will enable us to examine the behavior and look for what is causing it.
Regards,
Viktor Tachev
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).