Include Hidden Grid Columns in Exported Excel Files
Environment
Product | Grid for Progress® Kendo UI® |
Product Version | 2018.2.516 |
Description
How can I show some of the hidden columns of the Grid in the exported Excel file?
Solution
Use the hideColumn
or showColumn
methods to change the visibility of the columns before and after the export and utilize the excelExport
event.
The following code snippet demonstrates the implementation of the suggested approach.
var exportFlag = false;
$("#grid").data("kendoGrid").bind("excelExport", function (e) {
if (!exportFlag) {
e.sender.hideColumn(1);
e.preventDefault();
exportFlag = true;
setTimeout(function () {
e.sender.saveAsExcel();
});
} else {
e.sender.showColumn(1);
exportFlag = false;
}
});