New to Kendo UI for jQueryStart a free 30-day trial

Toolbar.items

configuration

An array collection of items to be rendered in the toolbar. Each item will be treated as the list of commands displayed in the grid's Toolbar. Commands can be custom or built-in ("cancel", "create", "save", "excel", "pdf").

  • The "cancel" built-in command reverts any data changes done by the end user.

  • The "create" command adds an empty data item to the grid.

  • The "canceledit" command cancels the changes to the dataItem that is being currenly edited.

  • The "update" command save the changes to the dataItem that is being currenly edited.

  • The "destroy" command removes the selected item. To work as expected, the grid should be selectable. If multiple selection is enabled, the item which will be remoed is the last selected one.

  • The "edit" command triggers the edit state of currently selected item. To work as expected, the grid should be selectable. If multiple selection is enabled, the item which will be edited is the last selected one.

  • The "save" command persists any data changes done by the end user. When executed fires saveChanges grid event.

  • The "excel" command exports the grid data in MS Excel format. Fires excelExport grid event.

  • The "pdf" command exports the grid data in PDF format. Fires pdfExport grid event.

  • The "search" command renders the built-in search panel for the grid.

  • The "columns" command renders a global column menu.

  • The "columns" command generates a button to open a global columns menu.

  • The "paste" command enables the user to switch between the "replace" and "insert" modes of the paste functionality. The allowPaste configuration must enabled for the dropdown to appear.

  • The "sort" command enables the user to use the sorting functionallity of the grid.

  • The "filter" command enables the user to use the filtering functionallity of the grid.

  • The "group" command enables the user to use the grouping functionallity of the grid.

  • The "columnChooser" command enables the user to change the visibillity of the grid's columns.

  • The "selectAll" command enables the user to select all rows if the grid is selectable.

  • The "aiAssistant" command renders the AI assistant tool in the toolbar.

  • The "smartBox" command renders the smart search box tool in the toolbar.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ],
  toolbar: {
    items: [
      { name: "create", text: "Add New" },
      { name: "excel", text: "Export to Excel" },
      { name: "pdf", iconClass: "k-icon k-i-file-pdf" },
      { name: "custom", text: "Custom Action", template: "<button class='k-button' onclick='customAction()'>Custom</button>" }
    ]
  },
  editable: true
});

function customAction() {
  alert("Custom action executed!");
}
</script>

Show a clear all sorts or clear all filters button.

Only applicable for Sort,Filter, and Group tools.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ],
  sortable: true,
  filterable: true,
  groupable: true,
  toolbar: {
    items: [
      { name: "sort", clearButton: true },
      { name: "filter", clearButton: true },
      { name: "group", clearButton: true }
    ]
  }
});
</script>

The class for the web font icon of the button that will be rendered in the toolbar.

Grid commands are rendered as anchors (<a>) with a span inside. The icon for the button depends on the iconClass which is rendered as a class for the inner span. Built-in commands have a predefined iconClass value.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ],
  toolbar: {
    items: [
      { name: "create", iconClass: "k-icon k-i-plus", text: "Add" },
      { name: "excel", iconClass: "k-icon k-i-file-excel" }
    ]
  },
  editable: true
});
</script>

The name of the toolbar command. Either a built-in ("cancel", "create", "save", "excel", "pdf") or custom. The name is reflected in one of the CSS classes, which is applied to the button - k-grid-name. This class can be used to obtain reference to the button after Grid initialization and attach click handlers.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ],
  toolbar: {
    items: [
      { name: "myCustomCommand", text: "My Command" }
    ]
  }
});

// Access button by CSS class derived from name
$(".k-grid-myCustomCommand").click(function() {
  alert("Custom command clicked!");
});
</script>

toolbar.items.template

String|Function

The template which renders the command. By default renders a button.

Check Toolbar template for a live demo.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ],
  toolbar: {
    items: [
      {
        name: "customDropDown",
        template: (data) => `<select class="k-dropdown">
                    <option>Option 1</option>
                    <option>Option 2</option>
                    <option>Option 3</option>
                  </select>`
      }
    ]
  }
});
</script>

The text displayed by the command button. If not set the name option would be used as the button text instead.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ],
  toolbar: {
    items: [
      { name: "create", text: "Add New Record" },
      { name: "excel", text: "Download Excel" }
    ]
  },
  editable: true
});
</script>