New to Kendo UI for jQuery? Start a free 30-day trial

CsvExport

events

Fired when the user clicks the "Export to CSV" toolbar button.

Event Data

e.sender kendo.ui.Grid

The widget instance which fired the event.

e.csv String

The generated CSV string. Modifications of the CSV content will reflect in the output file.

e.preventDefault Function

If invoked the grid will not save the generated file.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  toolbar: ["csv"],
  columns: [
    { field: "name" }
  ],
  dataSource: [
    { name: "Jane Doe"},
    { name: "John Doe"}
  ],
  csvExport: function(e) {
    console.log(e.csv);
  }
});
var grid = $("#grid").data("kendoGrid");
grid.wrapper.find(".k-grid-csv").trigger("click");
</script>
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  toolbar: ["csv"],
  columns: [
    { field: "name" }
  ],
  dataSource: [
    { name: "Jane Doe"},
    { name: "John Doe"}
  ]
});
var grid = $("#grid").data("kendoGrid");
grid.bind("csvExport", function(e) {
    console.log(e.csv);
});
grid.wrapper.find(".k-grid-csv").trigger("click");
</script>
Not finding the help you need?
Contact Support