Class: module:react-aiot/components/TreeNode

module:react-aiot/components/TreeNode

Tree node with child nodes and rename / create mode.

Constructor

new module:react-aiot/components/TreeNode(props)

Parameters:
Name Type Description
props object Properties
Properties
Name Type Attributes Default Description
id string | id The unique id for this node. Added as data-li-id to the li DOMElement and as data-id to the .aiot-node div-DOMElement
hash string <optional>
'' Use this field to force rerender of the node. This is useful if you use a state management library like mobx-state-tree and try to splice a child node.
className string <optional>
Additional class name for the .aiot-node div DOMElement
icon React.Element <optional>
The icon before the title
iconActive React.Element <optional>
The active icon before the title (replaces icon)
childNodes Array.<object> <optional>
[] If setted it must be a TreeNode property object array and it is added as child node to the current node
title string <optional>
The title
count string <optional>
The count
attr object.<key, string> <optional>
Additional attributes for the .aiot-node div DOMElement
renameSaveText React.Element | string <optional>
If $rename is true this button text is showed next to the input field
renameAddText React.Element | string <optional>
If $create is true this button text is showed next to the input field of the new created node
$busy boolean <optional>
If true the node gets overlayed by a spinning loader
$droppable boolean <optional>
true If true the .aiot-node gets the additional class .aiot-droppable
$visible boolean <optional>
true If true this node is rendered
$rename boolean <optional>
If true the title is replaced with an input field
$create object <optional>
If setted it must be a TreeNode property map and it is added as child node to the current node
searchSelected boolean <optional>
If true the .aiot-node gets the additional class .aiot-search-selected
expandedState boolean <optional>
true If true the child nodes of this node are rendered
displayChildren boolean <optional>
true If true the child nodes are renderable
selected boolean <optional>
The selected ids. If the selected ids contains the current id the .aiot-node gets an additional class .aiot-active
onRenameClose module:react-aiot/components/TreeNode#onRenameClose <optional>
onAddClose module:react-aiot/components/TreeNode#onAddClose <optional>
onSelect module:react-aiot/components/TreeNode#onSelect <optional>
onNodePressF2 module:react-aiot/components/TreeNode#onNodePressF2 <optional>
onExpand module:react-aiot/components/TreeNode#onExpand <optional>
onUlRef module:react-aiot/components/TreeNode#onUlRef <optional>
Source:

Extends

  • React.Component

Type Definitions

onAddClose(save, inputValue, props)

This function is called when a new tree node should be saved or the add process is cancelled.
Parameters:
Name Type Description
save boolean If true the node should be saved instead of cancelled
inputValue string The name for the node
props object passed to the TreeNode component
Source:

onExpand(expanded, props)

This function is called when a tree node is expanded or collapsed
Parameters:
Name Type Description
expanded boolean If true the childrens are visible
props object passed to the TreeNode component
Source:

onNodePressF2(props)

This function is called when a tree node is active and F2 is pressed. Useful to activate the rename process.
Parameters:
Name Type Description
props object passed to the TreeNode component
Source:

onRenameClose(save, inputValue, props)

This function is called when a tree node is in rename mode and the rename mode gets closed (ESC), cancelled or saved.
Parameters:
Name Type Description
save boolean If true the node should be saved instead of cancelled
inputValue string The name for the node
props object passed to the TreeNode component
Source:

onSelect(id)

This function is called when a tree node gets selected.
Parameters:
Name Type Description
id string | int The node id
Source:

onUlRef(ref, id)

This function is called when a tree node is expanded or collapsed
Parameters:
Name Type Description
ref DOMElement The reference
id string | id The node id
Source: