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

Error on Grid Excelexport

1 Answer 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 1
Allan asked on 29 Jul 2018, 03:10 PM

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

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 30 Jul 2018, 04:12 PM
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.
Tags
Grid
Asked by
Allan
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or