Custom Selection
The TreeList provides low-level hooks for implementing custom selection logic.
Setting the Selected Rows
You can control the selection state by specifying the isSelected
function. The function is executed for each row or cell in the TreeList and determines whether the item will be selected.
The built-in
kendoTreeListSelectable
directive applies its defaultisSelected
callback to determine which rows or cells will be selected. To override the default behavior, do not apply the directive when using a customisSelected
callback. To refresh the selected state and force re-evaluation of theisSelected
callback, invoke the TreeList updateView method.
The following example demonstrates row selection with isSelected
callback.
Setting the Selected Cells
To target specific cells, both dataItem
and columnIndex
can be used to determine which cells will be selected.
The following example demonstrates cell selection with isSelected
callback.
Persist Selection in Data Items
You can effectively persist the selected state of rows in the TreeList by employing the isSelected
callback and handling the selectionChange
event.
The following example demonstrates how to utilize these features to maintain the selected state as a field.