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

Definition

Package:@progress/kendo-angular-treeview

Selector:kendo-treeview

Export Name:Accessible in templates as #kendoTreeViewInstance="kendoTreeView"

Syntax:

html
<kendo-treeview
   kendoTreeViewExpandable
   [nodes]="data"
   textField="text"
   [children]="fetchChildren"
   [hasChildren]="hasChildren">
</kendo-treeview>

Inputs

animate

boolean

Enables or disables content animation.

A function that provides the child nodes for a given parent node (see example).

Parameters:itemobjectReturns:

Observable​<object[]>

Indicates whether only parent nodes should be disabled or their child nodes as well.

Default:

false

Allows expanding disabled nodes.

Default:

false

filter

string

Sets the initial value of the built-in filter input.

Default:

''

filterable

boolean

Renders the built-in input element for filtering. If true, emits the filterChange event that can be handled for manual filtering. Built-in filtering is available with kendoTreeViewHierarchyBinding and kendoTreeViewFlatDataBinding directives.

Default:

false

Sets the placeholder text for the filter input when the component is empty.

Default:

""

A function that determines if a node has a checkbox. If there is no checkbox, the node is not checkable and is excluded from built-in check functionality.

Parameters:itemobjectindexstringReturns:

boolean

Default:

hasCheckbox

hasChildren

(item: object) => boolean

A function that determines if a node has child nodes (see example).

isChecked

(item: object, index: string) => CheckedState

A function that determines if a node is checked (see example).

A function that determines if a node is disabled.

Parameters:itemobjectindexstringReturns:

boolean

Default:

isDisabled

isExpanded

(item: object, index: string) => boolean

A function that determines if a node is expanded.

isSelected

(item: object, index: string) => boolean

A function that determines if a node is selected (see example).

A callback that determines whether a TreeView node should be rendered as hidden. Uses the .k-hidden utility class. Useful for custom filtering.

Parameters:itemobjectindexstringReturns:

boolean

Default:

isVisible

Indicates whether child nodes are fetched on expand or initally prefetched.

Default:

true

boolean

Enables keyboard navigation for the TreeView.

Default:

true

nodes

any[]

The nodes displayed by the TreeView (see example).

Sets the size of the component.

Default:

undefined

textField

string | string[]

The fields of the data item that provide the text content of the nodes (see example). If set to an array, each level uses the field at the same index or the last item in the array.

A function that defines how to track node changes. By default, the TreeView tracks the nodes by data item object reference.

Default:

trackBy

Events

Fires after a dragged item is dropped (see example). Called on the TreeView where the item is dropped.

Fires when the component loses focus.

Fires when a TreeView node checkbox is selected (see example).

childrenLoaded

EventEmitter​<{ children: TreeItem[]; item: TreeItem }>

Fires when the children of the expanded node are loaded.

Fires when a TreeView node collapses.

Fires when a TreeView node expands.

Fires when the value of the built-in filter input changes.

Emits when the built-in filtering mechanism updates node visibility. Used for the built-in auto-expand functionalities. Handle this event for custom implementations.

Fires when the component receives focus.

Fires when a TreeView node is clicked.

Fires when a TreeView node is double-clicked.

Fires when an item is being dragged (see example).

Fires on the source TreeView after the dragged item is dropped (see example).

Fires just before node dragging starts (see example). This event is preventable. Prevent the default event to stop drag hint creation and further drag events.

Fires on the target TreeView when a dragged item is dropped (see example).

Prevent the default event (event.preventDefault()) or set the event as invalid (event.setValid(false)) to stop the addItem and removeItem events from triggering.

Use preventDefault to handle add/remove manually, or setValid(false) to indicate an unsuccessful operation. While setValid(false) animates the drag clue to its original position, event.preventDefault() simply removes the clue.

Fires after a dragged item is dropped (see example). Called on the TreeView from where the item is dragged.

Fires when a TreeView node is selected (see example).

Methods

Blurs the focused TreeView item.

Triggers the collapse event for the provided node.

Parameters:itemanyindexstring

Triggers the expand event for the provided node and shows its loading indicator.

Parameters:itemanyindexstring

Focuses the first focusable item in the TreeView if no hierarchical index is provided.

Parameters:index?string

Gets the current page size of the data item's children collection (see example). Pass null as dataItem to get the root collection's page size.

Parameters:dataItemany

{any} - The parent data item of the targeted collection.

Returns:

number

  • The page size of the data item's children collection.

Returns the TreeItemLookup node for the specified index.

Parameters:indexstring

The index of the node.

Returns:

TreeItemLookup

  • The looked up item.

Calls the children function for every expanded node and fetches all rendered child nodes again.

Sets the page size of the data item's children collection (see example). Pass null as dataItem to set the root collection's page size.

Parameters:dataItemany

{any} - The parent data item of the targeted collection.

pageSizenumber

{number} - The new page size.