This is a migrated thread and some comments may be shown as answers.

Kendo Grid Export to Excel

1 Answer 1038 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 11 May 2017, 03:35 PM

Please refer attached screen shot.

I have parent and child grids. Child grid has Export to Excel button. When we click Export to Excel in child grid, it should export the expanded row as well as all child grid rows. Right now I can export child grid data only.

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 15 May 2017, 01:25 PM
Hi Greg,

I have replied to your query in the support ticket you have submitted and suggest we continue the conversation there. For convenience i will paste the reply in the ticket below.


By default when you click on the Export button it would export the data in the related Grid component. This is why when you click the button in the child grid only the data from it is expanded.

If you would like to change the behavior you would need to implement a bit of custom code. You can add a custom button in the toolbar of the nested Grid. You can use toolbar.template for this.


Copy Code
.ToolBar(t=>t.Template("<class='k-button k-button-icontext' onclick='customCommand();' href='\\#'></span>Cutom Command</a>"))


This way you can get reference of the parent Grid and call saveAsExcel for it in order to export the data.


Copy Code
function customCommand() {
        var parentGrid = $("#grid").data("kendoGrid");
        parentGrid.saveAsExcel();
    }


For exporting the detail Grids you can use the approach described in the how-to article below:





Regards,
Viktor Tachev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Greg
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or