Hi Tsvetomir,
I use the code from Progress Indicator for exporting to excel
var grid;
function
StartExcelExport(e) {
kendo.ui.progress($(
"#grid"
),
true
);
toolbar.enable(
"#idexportButton"
,
false
);
//disables Toolbar Button
grid.saveAsExcel();
}
function
ExcelExport(e: any) {
// overriding the export event here allows us to insert
// the progress indicators, and hide them when the save complete
e.preventDefault();
$.when(
function
() {
var
def = jQuery.Deferred();
window.setTimeout(
function
() {
var
workbook =
new
kendo.ooxml.Workbook(e.workbook);
kendo.saveAs({
dataURI: workbook.toDataURL(),
fileName:
"Exportfile.xlsx"
,
proxyURL: $(
"#grid"
).data(
"kendoGrid"
).options.excel.proxyURL
});
def.resolve();
}, 100);
return
def.promise();
}())
.done(
function
() {
kendo.ui.progress($(
"#grid"
),
false
);
toolbar.enable(
"#idexportButton"
,
true
);
//enable Toolbar Button
});
}
In Init Code:
$("#toolbar").kendoToolBar({
items: [{
id:
"idexportButton"
,
type:
"button"
,
text:
"Export"
,
icon:
"file-excel"
,
click: StartExcelExport
}
]
});
grid = $(
"#grid"
).data(
"kendoGrid"
);
grid.bind(
"excelExport"
, ExcelExport);
});
Best regards,
Peter