ETree Tree
Examples
Checking, partial selection, filtering and drag and drop
Basic usage
Basic usage
Properties
accordionboolAccordion mode allowing at most one expanded node or collapse item at a level.
falseallowDragvarDrag guard receiving a node and returning whether dragging is allowed.
nullallowDropvarDrop guard receiving the dragged node, target node and drop position.
nullautoExpandParentboolExpand ancestors when expanding or locating a node.
truecheckOnClickLeafboolToggle checking when a leaf is clicked.
falsecheckOnClickNodeboolToggle checking when any node is clicked.
falsecheckStrictlyboolKeep parent and child selection independent.
falsecheckedKeysvarUnique keys of checked nodes or selected table rows.
[]currentKeystringUnique key of the selected node.
""defaultExpandAllboolExpand all nodes or rows initially.
falsedraggableboolEnable dragging of the object defined by the current component.
falsedraggingKeystringUnique key of the node being dragged.
""emptyDelegateComponentComponent slot for custom empty state; null uses the default content. See this page’s examples for delegate context.
nullemptyTextstringText displayed when no data is available.
Localized textenabledboolAllow interaction; false disables the control.
trueexpandOnClickNodeboolExpand or collapse when clicking node text.
falseexpandedKeysvarUnique keys of expanded nodes, table rows or menu entries.
[]filterNodeMethodvarNode filter callback (query, node), returning whether to retain the node.
nullfilterValuestringCurrent filtering or search query.
""heightrealComponent size in pixels; may be bound to its parent layout.
implicitHeighthighlightCurrentboolHighlight the selected node or row.
trueiconSourceintIcon used by the component.
EIcons.*
0 (no icon)
EIcons.CHEVRON_RIGHTindentintIndentation per tree or menu level in pixels.
18itemHeightintMenu item, data row or header row height in pixels.
34lazyboolCreate content or load data on demand; data controls use load / lazyLoad.
falseloadvarLazy-load callback receiving a node and resolve; call resolve(children) to provide children.
nullloadedChildrenvarLoaded child-node cache keyed by node identifier.
Dynamic bindingloadingKeysvarKeys of nodes or rows currently loading lazily.
[]modelvarTree node data array; props and nodeKey customize field mappings.
Fields:
id, label, children
disabled, isLeaf
[]nodeDelegateComponentComponent slot for custom tree or cascader node; null uses the default content. See this page’s examples for delegate context.
nullnodeKeystringUnique identifier field; stable unique keys preserve selection, expansion and caches.
"id"propsvarObject configuring data field mappings and node behavior.
Fields:
label, children, disabled
isLeaf
({})showCheckboxboolShow checkboxes for tree nodes.
falsevisibleboolWhether the component is visible.
truewidthrealComponent size in pixels; may be bound to its parent layout.
implicitWidthallNodesvarRead onlyFlattened array of all tree nodes.
Computed at runtimecheckSummaryvarRead onlySummary of checked and partially checked tree nodes.
Computed at runtimecurrentNodevarRead onlyData object of the selected tree node.
Computed at runtimehalfCheckedKeysvarRead onlyKeys of partially checked tree nodes.
Computed at runtimevisibleNodesvarRead onlyTree nodes visible after expansion and filtering.
Computed at runtimeSignals
nodeDragStarted(var node)Emitted when dragging starts; node is the dragged node.
checked(var node, var state)Emitted when node checking changes; node is the node and state contains the check result.
loadFailed(var node, var error)Emitted when loading a node fails; node is the node and error describes the failure.
nodeDragLeft(var node, var target)Emitted when a dragged node leaves a target; node is the dragged node and target is the node being left.
nodeDragOver(var node, var target)Emitted while dragging over a target; node is the dragged node and target is the target node.
nodeSelected(var node, string key)Emitted when a node is selected; node is its data and key is its identifier.
currentChanged(var node, string key)Emitted when the current node changes; node is its data and key is its identifier.
nodeContextMenu(var node, var mouse)Emitted when a node is right-clicked; node is its data and mouse is the mouse event.
nodeDragEntered(var node, var target)Emitted when a dragged node enters a target; node is the dragged node and target is the target node.
nodeExpanded(string key, bool expanded)Emitted when a node expands or collapses, with its identifier and expanded state.
nodeDropped(var node, var target, string position)Emitted after dropping a node; node is the dragged node, target is the target node, and position is the drop position.
nodeDragEnded(var node, var target, string position)Emitted when dragging ends; node is the dragged node, target is the target node, and position is the drop position.
checkChanged(var node, bool checked, bool halfChecked)Emitted when a node check state changes; node is the node, checked is its checked state, and halfChecked is its partial check state.
Methods
getCurrentKey()Return the current node identifier.
getCurrentNode()Return the current node data object.
getNode(key)Return the entry for key, including node data and hierarchy information.
getHalfCheckedKeys()Return the identifiers of all partially checked nodes.
toggle(key)Toggle the expanded or selected state; pass the target identifier when required.
isLoading(key)Return whether the node identified by key is loading.
isChecked(key)Return whether the specified item is checked.
isHalfChecked(key)Return whether the node identified by key is partially checked.
findNode(key)Return the node data for key, or null when not found.
remove(node)Remove the node specified by node.
filter(value)Set value as the tree filter text.
setCurrentNode(node, expandParents)Set the current node; expandParents controls expansion of its ancestors.
isExpanded(key)Return whether the specified item is expanded.
setCheckedNodes(nodes)Set the checked nodes to nodes.
updateKeyChildren(key, children)Replace the children of the node identified by key with children.
insertAfter(data, reference)Insert data after reference.
insertBefore(data, reference)Insert data before reference.
getHalfCheckedNodes()Return the data objects of all partially checked nodes.
getCheckedKeys(leafOnly)Return checked node identifiers; leafOnly limits the result to leaves.
setCurrentKey(key, expandParents)Set the current node by key; expandParents controls expansion of its ancestors.
select(key)Select the item identified by the given index or key.
getCheckedNodes(leafOnly, includeHalfChecked)Return checked nodes; leafOnly limits the result to leaves and includeHalfChecked includes partially checked nodes.
append(data, parentNode)Append node data under parentNode.
moveNode(key, targetKey, position)Move node key relative to targetKey using position.
setCheckedKeys(keys, leafOnly)Set checked nodes by keys; leafOnly limits changes to leaf nodes.
setExpanded(key, expanded)Set expansion of node key to expanded.
loadNode(key)Request child data for node key.
setChecked(key, value, deep)Set the checked state of key to value; deep also updates descendants.