Treeview
Last updated
Was this helpful?
Last updated
Was this helpful?
(part of package 'Servoy Extra Components') Extends designtime/SolutionModel: JSWebComponent Extends runtime: RuntimeWebComponent
A Servoy Extra Component that displays a tree view for hierarchical data.
This is a reference page; many components have detailed usage guides here.
JSDataSet used for the tree model. Type: JSDataset
CSS style classes applied to the tree view component. Type:
Fired when a node is clicked.
Parameters:
Fired when a node is collapsed.
Parameters:
{Object} nodeId The identifier of the node that was collapsed.
Fired when a node is double-clicked.
Parameters:
Fired when a node is expanded.
Parameters:
{Object} nodeId The identifier of the node that was expanded.
Fired when a node is right-clicked.
Parameters:
Fired when a node is selected.
Parameters:
{Object} nodeId The identifier of the node that was selected.
Fired when the tree view is ready.
Parameters:
{JSEvent} event The event object associated with the tree view being ready.
Collapse all nodes
Example:
Returns: Boolean Returns `true` if all nodes were successfully collapsed, otherwise `false`.
Collaps a node by id.
Example:
Parameters:
{Object} nodeId The identifier of the node to collapse.
Expand all nodes
Example:
Returns: Boolean Returns `true` if all nodes were successfully expanded, otherwise `false`.
Expand a node by id.
Example:
Parameters:
{Object} nodeId The identifier of the node to expand.
Dimm or hide unmatched branches. Matching nodes are displayed together with all descendants.
Parameters:
Dimm or hide unmatched nodes. NOTE: This function might not work as expected if the node titles contain HTML markup.
Example:
Parameters:
{String} text Filter nodes matching the given text
{Object} [options] Filter options List of options: autoExpand**, type: {boolean}, default: false Temporarily expand matching node parents while filter is active. fuzzy**, type: {boolean}, default: false Match single characters in order, e.g. 'fb' will match 'FooBar'. hideExpanders**, type: {boolean}, default: false Hide hideExpanders expanders if all child nodes are hidden by filter. highlight**, type: {boolean}, default: false Highlight matches by wrapping inside tags. leavesOnly**, type: {boolean}, default: false Match end nodes only. mode**, type: {string: 'dimm' | 'hide'}, default: 'hide' Defines if unmatched nodes are grayed out or hidden. nodata**, type: {boolean|string|object|function}, default: true Display the string 'No data' if the filtered tree would be empty.
Get child nodes ids of a parent node.
Example:
Parameters:
{Object} nodeId The identifier of the parent node whose child node IDs are to be retrieved.
Returns: Array<Object> Returns an array of objects representing the IDs of the child nodes for the specified parent node.
Get the tree level a node is situated.
Example:
Parameters:
{Object} nodeId The identifier of the node whose level is to be determined.
Returns: Number Returns the level of the specified node within the tree structure, where the root level is typically 0.
Get child nodes ids of a parent node.
Example:
Parameters:
{Object} nodeId The identifier of the parent node whose child node IDs are to be retrieved.
Returns: Object Returns an object containing the IDs of the child nodes for the specified parent node.
Get root nodes ids .
Example:
Returns: Array<Object> Returns an array of objects representing the IDs of the root nodes in the tree structure.
Get selected node id.
Example:
Returns: Object Returns the selected node object, including its `id` and any other relevant properties.
Returns expand state of a node.
Example:
Parameters:
{Object} nodeId Array of each level id
Returns: Boolean Returns `true` if the specified node is expanded, otherwise `false`.
Refresh the tree display.
Example:
Parameters:
{Boolean} restoreExpandedNodes Indicates whether the previously expanded nodes should be restored after the tree is refreshed. Set to `true` to restore expanded nodes, or `false` to collapse all nodes.
Sets the column width
Example:
Parameters:
{Number} columnWidth Column width
Sets the tree data
Example:
Parameters:
{JSDataset} jsDataSet The JSDataSet used for the tree model
Sets selected node by id.
Example:
Parameters:
{Object} nodeId The identifier of the node to set as selected.