Optional
_filterOptional
checkboxRender a checkbox or radio button
Array of child nodes (null for leaf nodes).
For lazy nodes, this is null
or ùndefineduntil the children are loaded and leaf nodes may be
[]` (empty array).
Additional classes added to div.wb-row
.
Optional
colspanIf true, (in grid mode) no cells are rendered, except for the node title.
Custom data that was passed to the constructor
Optional
expandedExpansion state.
Optional
iconIcon definition.
Readonly
keyUnique key. Passed with constructor or defaults to SEQUENCE
.
Use setKey to modify.
Optional
lazyLazy loading flag.
Optional
matchParent node (null for the invisible root node tree.root
).
Optional
radiogroupIf true, this node's children are considerd radio buttons.
Readonly
refReference key. Unlike key, a refKey
may occur multiple
times within a tree (in this case we have 'clone nodes').
Use setKey to modify.
Optional
selectedSelection state.
Optional
statusOptional
subName of the node.
Use setTitle to modify.
Optional
Internal
titleOptional
tooltipTooltip definition (true
: use node's title).
Reference to owning tree.
Optional
typeNode type (used for styling).
Optional
unselectableStatic
sequenceIterate all descendant nodes depth-first, pre-order using for ... of ...
syntax.
More concise, but slightly slower than WunderbaumNode.visit.
Example:
for(const n of node) {
...
}
Optional
options: RenderOptionsAppend (or insert) a list of child nodes.
Tip: pass { before: 0 }
to prepend new nodes as first children.
Optional
options: AddChildrenOptionsfirst child added
Append or prepend a node, or append a child node.
This a convenience function that calls addChildren()
node definition
Optional
mode: InsertNodeType = "appendChild"'before', 'after', 'firstChild', or 'child' ('over' is a synonym for 'child')
new node
Apply a modification (or navigation) operation.
Collapse all expanded sibling nodes if any.
(Automatically called when autoCollapse
is true.)
Optional
options: SetExpandedOptionsCall setExpanded()
on all descendant nodes.
Optional
options: ExpandAllOptionsFind all descendant nodes that match condition (excluding self).
If match
is a string, search for exact node title.
If match
is a RegExp expression, apply it to node.title, using
RegExp.test().
If match
is a callback, match all nodes for that the callback(node) returns true.
Returns an empty array if no nodes were found.
Examples:
// Match all node titles that match exactly 'Joe':
nodeList = node.findAll("Joe")
// Match all node titles that start with 'Joe' case sensitive:
nodeList = node.findAll(/^Joe/)
// Match all node titles that contain 'oe', case insensitive:
nodeList = node.findAll(/oe/i)
// Match all nodes with `data.price` >= 99:
nodeList = node.findAll((n) => {
return n.data.price >= 99;
})
Return the direct child with a given key, index or null.
Find first descendant node that matches condition (excluding self) or null.
WunderbaumNode.findAll for examples.
Find a node relative to self.
Fix selection status, after this node was (de)selected in selectMode: 'hier'
.
This includes (de)selecting all descendants.
Optional
opts: SetSelectedOptionsFix selection status for multi-hier mode. Only end-nodes are considered to update the descendants branch and parents. Should be called after this node has loaded new children or after children have been modified using the API.
Optional
opts: SetSelectedOptionsReturn a multiline string representation of a node/subnode hierarchy. Mostly useful for debugging.
Example:
console.info(tree.getActiveNode().format((n)=>n.title));
logs
Books
├─ Art of War
╰─ Don Quixote
Optional
name_cb: NodeStringCallbackOptional
connectors: string[]Iterator version of WunderbaumNode.format.
Optional
name_cb: NodeStringCallbackOptional
connectors: string[]Return all nodes with the same refKey.
Include this node itself.
Return the first child node or null.
Return the last child node or null.
Return the successive node (under the same parent) or null.
Return an option value that has a default, but may be overridden by a callback or a node instance attribute.
Evaluation sequence:
tree.options.<name>
is a callback that returns something, use that.node.<name>
is defined, use that.tree.types[<node.type>]
is a value, use that.tree.options.<name>
is a value, use that.defaultValue
.name of the option property (on node and tree)
Optional
defaultValue: anyreturn this if nothing else matched Wunderbaum.getOption
Return the parent node (null for the system root node).
Return an array of all parent nodes (top-down).
Include the invisible system root node.
Include the node itself.
Return a string representing the hierachical node path, e.g. "a/b/c".
property name or callback
Return the preceeding node (under the same parent) or null.
Return an array of selected nodes.
only return the topmost selected node (useful with selectMode 'hier')
Return true if this node is a direct or indirect parent of other
.
Return true if this node is a direct subnode of other
.
Return true if this node is a direct or indirect subnode of other
.
Return true if this node is a direct parent of other
.
Return true if this node is selected, i.e. the checkbox is set.
undefined
if partly selected (tri-state), false otherwise.
Download data from the cloud, then call .update()
.
Expand all parents and optionally scroll into visible area as neccessary. Promise is resolved, when lazy loading and animations are done.
Optional
options: MakeVisibleOptionspassed to setExpanded()
.
Defaults to {noAnimation: false, noEvents: false, scrollIntoView: true}
Move this node to targetNode.
Optional
map: NodeAnyCallbackSet focus relative to this node and optionally activate.
'left' collapses the node if it is expanded, or move to the parent otherwise. 'right' expands the node if it is collapsed, or move to the first child otherwise.
'down', 'first', 'last', 'left', 'parent', 'right', or 'up'.
(Alternatively the event.key
that would normally trigger this move,
e.g. ArrowLeft
= 'left'.
Optional
options: NavigateOptionsRenumber nodes _nativeIndex
. This is useful to allow to restore the
order after sorting a column.
This method is automatically called after loading new child nodes.
Optional
options: ResetOrderOptions0.11.0
Make sure that this node is visible in the viewport.
Optional
options: ScrollIntoViewOptionsActivate this node, deactivate previous, send events, activate column and scroll into viewport.
Optional
options: SetActiveOptionsAdd/remove one or more classes to <div class='wb-row'>
.
This also maintains node.classes
, so the class will survive a re-render.
one or more class names. Multiple classes can be passed as space-separated string, array of strings, or set of strings.
Expand or collapse this node.
Optional
options: SetExpandedOptionsModify the check/uncheck state.
Optional
options: SetSelectedOptionsDisplay node status (ok, loading, error, noData) using styles and a dummy child node.
Optional
options: SetStatusOptionsSet the node tooltip.
Convenience method to implement column sorting.
0.11.0
Sort child list by title or custom criteria.
custom compare function(a, b) that returns -1, 0, or 1 (defaults to sorting by title).
pass true to sort all descendant nodes recursively
Convert node (or whole branch) into a plain object.
The result is compatible with node.addChildren().
include child nodes
Optional
callback: NodeToDictCallbackis called for every node, in order to allow
modifications.
Return false
to ignore this node or "skip"
to include this node
without its children.
Toggle the check/uncheck state.
Optional
options: SetSelectedOptionsTrigger modifyChild
event on a parent to signal that a child was modified.
Type of change: 'add', 'remove', 'rename', 'move', 'data', ...
Optional
extra: anyTrigger a repaint, typically after a status or data change.
change
defaults to 'data', which handles modifcations of title, icon,
and column content. It can be reduced to 'ChangeType.status' if only
active/focus/selected state has changed.
This method will eventually call WunderbaumNode._render with default options, but may be more consistent with the tree's Wunderbaum.update API.
Call callback(node)
for all descendant nodes in hierarchical order (depth-first, pre-order).
Stop iteration, if fn() returns false. Skip current branch, if fn()
returns "skip".
Return false if iteration was stopped.
the callback function. Return false to stop iteration, return "skip" to skip this node and its children only.
IterableIterator
Call fn(node) for all parent nodes, bottom-up, including invisible system root.
Stop iteration, if callback() returns false.
Return false if iteration was stopped.
the callback function. Return false to stop iteration
Call fn(node) for all sibling nodes.
Stop iteration, if fn() returns false.
Return false if iteration was stopped.
the callback function. Return false to stop iteration.
include this node in the iteration.
A single tree node.
NOTE:
Generally you should not modify properties directly, since this may break the internal bookkeeping.