csvExport
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.
Example - subscribe to the "csvExport" event during initialization
<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>
Example - subscribe to the "csvExport" event after initialization
<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>