http://demos.telerik.com/kendo-ui/grid/editing-custom
It only shows the header, not the values.
regards,
Olafur
5 Answers, 1 is accepted
Yes, by design the data from the data source is exported. If a grid column has its template set it will be ignored. Templates can be arbitrary HTML which doesn't translate to Excel. If the template isn't HTML you can manually use it as shown in this help article: http://docs.telerik.com/kendo-ui/web/grid/how-to/excel/column-template-export
Regards,
Atanas Korchev
Telerik
In the example, the 'excelExport' handler has to create a dummy version of the original DataSource record, containing only the 'unitPrice' field, to pass to the template as it loops through. This would fail if the template relied on any other information in the record for the row.
For instance, say you ahd data something like {database_id:42, displayString: "Forty Two"}, and were displaying a column for "database_id" with the template "#=displayString#". This works fine in the grid, where the template has the entire dataSource record available to it. But in the Excel example, all connection with the dataSource record would be lost by the time of the "excelExport" event - the entire spreadsheet has been created? There would be no way to get the "displayString" value to insert it into the dummy record being passed to the template handler.
It looks like there is a way to directly export to Excel from a DataSource record, which I'm going to try for a situation similar to what I described. But it would be nice if a column grid's template attribute could be somehow marked as safe for use in other contexts such as export formatting, or there was a separate "exportTemplate" attribute that could be set.
Hello Troy,
The excelExport event handler has an e.data parameter, which is essentially the array of dataItems used to create the workbook. You could use it in the described scenario to access other properties of the dataItem.
Regards,Dimiter Madjarov
Telerik by Progress