This is a migrated thread and some comments may be shown as answers.

saveAsExcel with all pages

1 Answer 911 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 18 May 2017, 01:51 PM
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();
 
             
        }
    });        
     
}

1 Answer, 1 is accepted

Sort by
0
Jeff
Top achievements
Rank 1
answered on 18 May 2017, 01:58 PM

Figured it out using the setOptions function

 

grid.setOptions({
    excel: {
        allPages: true
    }
Tags
Grid
Asked by
Jeff
Top achievements
Rank 1
Answers by
Jeff
Top achievements
Rank 1
Share this question
or