Tree control

Updated at:

Introduction

The tree control component displays hierarchical relational data in a tree structure, allowing users to browse and manage data by expanding, collapsing, and selecting each node.

Configuration items

Category

Configuration

Example

Description

Content

Option list

Data source for the tree control component. Manual configuration and mapping patterns are supported.

Expanded items

image

The value of the currently expanded tree node.

Interaction

Hide

Controls the default display state of the tree control component. When set to true, the component is hidden. For more information, see General properties.

Disable

Specifies whether to disable the tree control component.

Checkbox

Specifies whether to display checkboxes.

Drag and Drop

Specifies whether tree nodes are draggable.

Search

Specifies whether to display the search box.

Style

Height

Component height. For more information, see General properties.

Margin

For more information, see General properties.

Show icon

Specifies whether to use custom expand/collapse icons. If this is not enabled, default icons are used.

Icon mode

When "Show icon" is enabled, you can select an icon mode.

Fixed icon

Three fixed sets of icons are provided.

Custom icon

Customize the expand/collapse icons for tree nodes.

If you only set the expand icon, the collapse icon is the expand icon rotated 90 degrees counter-clockwise. If you only set the collapse icon, the expand icon is the collapse icon rotated 90 degrees clockwise.

Node occupies full row

Specifies whether a node occupies the entire row.

Show connecting lines

Specifies whether to show connecting lines between tree nodes.

CSS style

Node hover background color

The background color when the mouse hovers over a tree node.

Node selected background color

The background color when a tree node is selected.

Text color

The text color of tree nodes.

Search match text color

The color of the text that matches the search query in a tree node. For each node, this applies only to the first matched text.

Properties and methods

Name

Type

Example

Description

treeData

array

tree1.treeData

Read-only. The data source of the current tree control component.

expandedKeys

array

tree1.expandedKeys

The expanded items of the current tree control component.

checkedKeys

array

tree1.checkedKeys

The selected items of the current tree control component.

disabled

boolean

tree1.disabled

Specifies whether the current tree control component is disabled.

showSearch

boolean

tree1.showSearch

Specifies whether the data source of the tree control component can be searched.

checkable

boolean

tree1.checkable

Specifies whether to display checkboxes for tree nodes.

draggable

boolean

tree1.draggable

Specifies whether tree nodes are draggable.

hidden

boolean

tree1.hidden

Specifies whether the current component is hidden. For more information, see General properties.

setExpandedKeys

func

tree1.setExpandedKeys(['option1'])

Sets the value of the expanded node in the tree control to option1.

clearExpandedKeys

func

tree1.ExpandedKeys()

Clears the value of the expanded node in the tree control.

setCheckable

func

tree1.setCheckable(true)

Enables or disables checkboxes for the tree control. The parameter can be true or false.

clearCheckable

func

tree1.clearCheckable()

Clears the checkbox state of the tree control.

setCheckedKeys

func

tree1.setCheckedKeys(['option1'])

When checkboxes are enabled, sets the value of the selected checkbox node in the tree control to option1.

clearCheckedKeys

func

tree1.setCheckedKeys()

Clears the value of the selected checkbox node in the tree control.

setDraggable

func

tree1.setDraggable(true)

Enables or disables dragging for the tree control. The parameter can be true or false.

clearDraggable

func

tree1.clearDraggable()

Clears the draggable state of the tree control.

setDisabled

func

tree1.setDisabled(true)

Enables or disables the tree control. The parameter can be true or false.

clearDisabled

func

tree1.clearDisabled()

Clears the disabled state of the tree control.

setShowSearch

func

tree1.setShowSearch(true)

Specifies whether to allow filtering the data source of the tree control. The parameter can be true or false.

clearShowSearch

func

tree1.clearShowSearch()

Clears the filtering state of the tree control.

setHidden

func

tree1.setHidden(false)

Hides or shows the tree control. The parameter can be true or false. For more information, see General properties.

clearHidden

func

tree1.clearHidden()

Clears the hidden state of the tree control. For more information, see General properties.

Event callbacks

Configuration

Description

The event that is triggered when a node in the tree control is selected.

The event that is triggered when a tree node is expanded.

The event that is triggered when a tree node checkbox is selected.

The event that is triggered when a search is performed on the tree nodes.