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

Using Helper Functions

The TreeView enables you to update parent and child nodes as well as items in an indeterminate state by using helper functions.

Setup

To implement such use case scenarios, use the following helper functions:

Example
View Source
Change Theme:

Customizing Single Item Checking

By default, handleTreeViewCheckChange and processTreeViewItems work with hierarchical item indices. Alternatively, you can use a custom item field which uniquely describes the item (for example, an ID column from a database) by setting the idField of the TreeViewCheckDescriptor to the name of the custom field.

By default, a TreeView item is in an indeterminate state when its checkIndeterminate field is set to true. Also, the application of an indeterminate state to TreeView items is decoupled from the selection mode (single or multiple).

To enable the application of an indeterminate state, use the applyCheckIndeterminate field of the TreeViewCheckDescriptor. To use a custom item field instead of the checkIndeterminate field:

  1. Set the checkIndeterminateField field of the TreeViewCheckDescriptor to the name of the custom field.
  2. Set the checkIndeterminateField property of the TreeView to the name of the custom field.
Example
View Source
Change Theme:

Customizing Multiple Item Checking

By default, handleTreeViewCheckChange and processTreeViewItems work with hierarchical item indices. Alternatively, you can use a custom item field which uniquely describes the item (for example, an ID column from a database) by setting the idField of the TreeViewCheckDescriptor to the name of the custom field.

By default, a TreeView item is checked when its checked field is set to true. To use a custom item field instead of the checked field:

  1. Set the operationField field of the TreeViewCheckDescriptor to the name of the custom field.
  2. Set the checkField property of the TreeView to the name of the custom field.
Example
View Source
Change Theme: