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

Exporting 2 Levels of Details Including Original Grid

2 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 01 Jul 2016, 05:49 PM
I am following the example at http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/excel/detail-grid-export to export data to an Excel spreadsheet. The customer would like 2 levels of details including the overarching information. I am having difficulty creating that second detail line in Excel. It is appearing fine in the HTML grid. It displays the Codes and then the second level is Agencies and then the third level is a list of contacts. The exported Excel document only contains the Codes and the Agencies at the moment. I've attempted creating a second function detailInit(e) and calling that within detailInit(e) but to no avail. If you could point me to the code which needs to be replicated for a third level it would be much appreciated. Included is an example of the 3 tier grid that I am working with.

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Madjarov
Telerik team
answered on 04 Jul 2016, 07:27 AM

Hello David,

At the moment we don't have an example to cover the case for three or more levels hierarchy exported to Excel, because in order to be implemented, it will required a lot of custom code to be added to the approach from our documentation.
As a start you should indeed replicate the deferred logic in the detailInit handler for the third level, but include an additional boolean parameter when resolving it:

excelExport: function (e) {
  // prevent saving the file
  e.preventDefault();
 
  // resolve the deferred
  deferred.resolve({
    masterRowIndex: masterRowIndex,
    isThirdLevel: true,
    sheet: e.workbook.sheets[0]
  });
}

This way you will be able to differentiate the second and third level Grids in the excelExport event handler of the master Grid and be able to indentate them appropriately.

Regards,
Dimiter Madjarov
Telerik
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
David
Top achievements
Rank 1
answered on 15 Jul 2016, 02:14 PM
Thank you for the help. I was hoping that it would just be a quick repeat of code. I was able to convince the customer to keep it to two levels.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
David
Top achievements
Rank 1
Share this question
or