Kendo Grid Export to Excel

2 posts, 0 answers
  1. Greg
    Greg avatar
    20 posts
    Member since:
    May 2012

    Posted 11 May Link to this post

    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.

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1727 posts

    Posted 15 May Link to this post

    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.
Back to Top