saveAsExcel with all pages

2 posts, 0 answers
  1. Jeff
    Jeff avatar
    7 posts
    Member since:
    Mar 2017

    Posted 18 May 2017 Link to this post

    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();
     
                 
            }
        });        
         
    }
  2. Jeff
    Jeff avatar
    7 posts
    Member since:
    Mar 2017

    Posted 18 May 2017 in reply to Jeff Link to this post

    Figured it out using the setOptions function

     

    grid.setOptions({
        excel: {
            allPages: true
        }
Back to Top