Data Binding
The Kendo UI for Vue TreeView enables you to work with various types of data.
Basics
To bind the TreeView to data:
- Add children items to an item with an
items
field. - Configure the
data
property.
Item Fields
By default, the TreeView provides the following fields for its items:
text
—The string representation of the item.items
—The children of the item.expanded
—If set totrue
, expands the item.selected
—If set totrue
, selects the item.disabled
—If set totrue
, disables the item.checked
—If set totrue
, checks the item.checkIndeterminate
—If set totrue
, applies an indeterminate check to the item.hasChildren
—If set totrue
, notifies the TreeView that the item has children even if they are not initially passed. Used for implementing the load-on-demand feature.
Apart form items
, you can replace each of the default TreeView fields with custom ones. To include your own fields, set the corresponding TreeView property to the name of the custom field. The TreeView also supports the nesting of its item fields.
Loading Data on Demand
The following example demonstrates how to fetch remote data and bind the TreeView to it.
To implement the load-on-demand feature:
- Set the
hasChildren
field of the root items. - Provide their children afterwards.