exportSelectedToCSV
Exports the selected rows to a CSV file.
Parameters
includeHeaders Boolean
If set to true, the exported items will include the column headers.
Example
<div id="grid"></div>
<a class="k-button" onclick="selectAndExport()">Select and export</a>
<script>
$("#grid").kendoGrid({
columns: [
{ field: "productName" },
{ field: "category" }
],
dataSource: {
data: [
{ productName: "Tea", category: "Beverages" },
{ productName: "Coffee", category: "Beverages" },
{ productName: "Ham", category: "Food" },
{ productName: "Bread", category: "Food" }
]
},
selectable: "multiple, row"
});
function selectAndExport() {
var grid = $("#grid").data("kendoGrid");
grid.select($('#grid tbody tr').slice(0,2));
grid.exportSelectedToCSV(true);
}
</script>