I'm writing a universal function that will apply a standard context menu to every single grid on our whole site. My problem is, I'm trying to also universally bind the option to export all pages and cannot find any documentation on how to apply it via the saveAsExcel function. Here is my JS function
function
Universal_Grid_ContextMenu(grid) {
$(
"#context-menu"
).kendoContextMenu({
target: grid,
select:
function
(e) {
var
element = e.item;
var
grid = $(e.target).data(
"kendoGrid"
);
var
action = $(element).attr(
"data-action"
);
if
(action != undefined && grid !=undefined) {
switch
(action) {
case
"grid_menu_export"
:
grid.bind(
"excel"
,
function
(e) {
e.workbook.allPages =
true
});
grid.saveAsExcel();
break
;
case
"grid_menu_refresh"
:
grid.dataSource.read();
grid.refresh();
break
;
}
}
console.log();
}
});
}