excelExport

Fires when the user clicks the Export to Excel toolbar button.

Event Data

e.sender kendo.ui.TreeList

The widget instance which fired the event.

e.data Array

(Available as of the 2014.3.1205 release) The array of data items that is used to create the Excel workbook.

e.workbook Object

The Excel workbook configuration object. Used to initialize a kendo.ooxml.Workbook class. Modifications of the workbook will be reflected in the output Excel document.

e.preventDefault Function

If invoked, the TreeList will not save the generated file.

Example - subscribing to the excelExport event during initialization

<div id="treeList"></div>
<script>
  $("#treeList").kendoTreeList({
    toolbar: ["excel"],
    columns: [
      { field: "Name" },
      { field: "Position" }
    ],
    dataSource: [
      { id: 1, Name: "Daryl Sweeney", Position: "CEO", parentId: null },
      { id: 2, Name: "Guy Wooten", Position: "Chief Technical Officer", parentId: 1 }
    ],
    excelExport: function(e) {
      e.workbook.fileName = "Employees.xlsx";
    }
  });
  var treeList = $("#treeList").data("kendoTreeList");
  treeList.saveAsExcel();
</script>

Example - subscribing to the excelExport event after initialization

<div id="treeList"></div>
<script>
  $("#treeList").kendoTreeList({
    toolbar: ["excel"],
    columns: [
      { field: "Name" },
      { field: "Position" }
    ],
    dataSource: [
      { id: 1, Name: "Daryl Sweeney", Position: "CEO", parentId: null },
      { id: 2, Name: "Guy Wooten", Position: "Chief Technical Officer", parentId: 1 }
    ],
    excelExport: function(e) {
      e.workbook.fileName = "Employees.xlsx";
    }
  });
  var treeList = $("#treeList").data("kendoTreeList");
  treeList.bind("excelExport", function(e) {
    e.workbook.fileName = "Employees.xlsx";
  });
  treeList.saveAsExcel();
</script>
In this article
Not finding the help you need? Improve this article