I have a kendo grid and I can export its data into excel file without any problem. In my grid, some columns may be hidden because they do not have any value. However, I want
You can add some javascript to control this.
var exportFlag = true;
$("#gridName").data("kendoGrid").bind("excelExport", function (e) {
if (exportFlag) {
e.sender.showColumn("hiddenColumnName");
e.preventDefault();
exportFlag = false;
e.sender.saveAsExcel();
} else {
e.sender.hideColumn("hiddenColumnName");
exportFlag = true;
}
});
Basically this catches the excelExport
event when you click the Export button and shows the hidden column in your grid before it fires the saveAsExcel()
function which saves your document. Then it hides the column again.
Here is an Example you can test with.