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

Persisting the Selection

To define the collection that will store the selected items, specify the selectedItems option together with the kendoTreeListSelectable directive. This approach provides you with full control over the TreeList selection state—for example, you can specify the initially selected items, manually update the collection, and more.

Persisting the Row Selection

By default, the TreeList row selection is persisted by using the idField of the data item as key. If no idField is specified, the data item is persisted by reference.

Persisting Row Selection Based on a Specific Field

To persist the row selection based on the value of a specific field, set the itemKey to the name of the field.

The following example demonstrates how to store the selected items by the name field.

Example
View Source
Change Theme:

Persisting Row Selection Based on Computed Values

To persist the row selection based on a computed value, such as a composite key, set the itemKey to a function that returns the key value for a given data item.

The following example demonstrates how to store the selected items by a key that concatenates two data item fields.

Example
View Source
Change Theme:

Persisting the Cell Selection

By default, the TreeList cell selection is persisted by using the idField and the cell index as key. If no idField is specified, the data item is persisted by reference.

Persisting Cell Selection Based on a Specific Field

To persist the cell selection based on the value of a specific field, set the itemKey to the name of the field.

The following example demonstrates how to store the selected items by the name field and cell index.

Example
View Source
Change Theme:

Persisting Cell Selection Based on Computed Values

To persist the cell selection based on a computed value, such as a composite key, set the itemKey to a function that returns the key value for a given data item. The columnKey can be set to a function to customize the persisted column key value.

The following example demonstrates how to store the selected items by a key that concatenates two data item fields.

Example
View Source
Change Theme: