new TreeListNode(options)
Create a node for the TreeList
This class is made to create each node in the TreeList. Nodes are build recursively and stored in a child nodes array. Each node contains identification information, among other useful values ; depth in tree, expand state and leaf state. They also hold any mouse interaction the user could have on the node. Finally, those nodes are expandable/collapsable if they contain child nodes.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | The node options Properties
|
- Since:
- October 2020
Members
-
private _children :array
-
The node children
-
private _clicked :function
-
The callback function to call when node is clicked
-
private _depth :number
-
The node depth in graph
-
private _dom :object
-
The node DOM elements
-
private _id :number
-
The node ID
-
private _isExpanded :boolean
-
The expand state of node
-
private _isLeaf :boolean
-
The leaf state of node
-
private _name :string
-
The node name to display
-
private _svgPath :object
-
Expand/Collapse icon svg pathes
-
children :array
-
The node children
-
container :object
-
The node DOM container
Methods
-
private, static _buildUI()
-
This method will build the node DOM element and fill their attributes.
-
private, static _onNodeClick()
-
This method is called on click event on the node container. It will call the given callback if any was provided.
-
private, static _onNodeToggle()
-
This method will collapse or expand node only if it has children.
-
static collapse(recursiveopt)
-
This method will collapse the node only if it has children. The collapse can be recursiv through the node children if given flag is provided.
Parameters:
Name Type Attributes Default Description recursive
boolean <optional>
false Propagate the collapse call through each children of this node
-
static collapseAll()
-
This method will collapse all nodes starting from this node.
-
static destroy()
-
TreeListNode destructor. Will delete node and its children, their events and their properties.
-
static expand(recursiveopt)
-
This method will expand the node only if it has children. The expand can be recursiv through the node children if given flag is provided.
Parameters:
Name Type Attributes Default Description recursive
boolean <optional>
false Propagate the expand call through each children of this node
-
static expandAll()
-
This method will expand all nodes starting from this node.
-
static setExpander()
-
This method will append an expander to the node only if it has children. It must be called we all the TreeList is created, since it is recursive. See TreeList implementation.