Error on Grid Excelexport

2 posts, 0 answers
  1. Allan
    Allan avatar
    1 posts
    Member since:
    May 2018

    Posted 29 Jul Link to this post

    I have tried to find som help on why i can't use this binding feature to my excel export part of the mvc grid compoment.

        var grid = $("#grid").data("kendoGrid");
        grid.bind("excelExport", function (e) {
            e.workbook.fileName = "Grid.xlsx";
        });
        grid.saveAsExcel();

     

    This i my first beginning of these binding options, and the goal is to use them to hide/show during export.
    To get to this goal, is need the first part solved first- my binding fails in the bold line in script performance on website.

     

    The error is:Uncaught TypeError: Cannot read property 'bind' of undefined

     

    Whay cant i use this bind to capure the excelExport event ??

     

    regards

    Allan

  2. Tsvetomir
    Admin
    Tsvetomir avatar
    85 posts

    Posted 30 Jul Link to this post

    Hi Allan,

    I created a sample Dojo project which resembles the scenario you are willing to achieve. Depending on whether the button outside the grid has been clicked, the export file name changes. 

    You can find the sample here: Change Export Name

    The sample utilizes the bind method, similar to the sample demonstrated and explained in this article:
    https://docs.telerik.com/kendo-ui/intro/widget-basics/events-and-methods#handling-widget-events

    The error you are facing indicates that the grid instance is not properly accessed. Please verify that the name/id of the grid widget is correct and it is available at this time of initiating the script logic.

    Regards,
    Tsvetomir
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top