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.
Optional
iconIcon tooltip definition (true
: use node's title).
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
sequenceInternal
Return true if at least on selectable descendant end-node is unselected.
Call event handler if defined in tree.options. Example:
node._callEvent("edit.beforeEdit", {foo: 42})
Optional
extra: anyOptional
options: RenderOptionsIterate 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) {
...
}
Append (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.
true to expand, false to collapse.
Optional
options: ExpandAllOptionsAdditional options.
Find 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 <span class='wb-col'>
element with a given index or id.
Return the first child node or null.
Return the last child node or null.
Return node depth (starting with 1 for top level nodes).
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 node has children. Return undefined if not sure, i.e. the node is lazy and not yet loaded.
Return true if node has className set.
Return true if this node is the currently active tree node.
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's refKey is used by at least one other node.
Return true if this node's title spans all columns, i.e. the node has no grid cells.
Return true if this node is a direct or indirect subnode of other
.
Return true if this node is currently in edit-title mode.
Return true if this node has children, i.e. the node is generally expandable.
If andCollapsed
is set, we also check if this node is collapsed, i.e.
an expand operation is currently possible.
Return true if this node is currently expanded.
Return true if this node is the first node of its parent's children.
Return true if this node is the last node of its parent's children.
Return true if this node is lazy (even if data was already loaded)
Return true if node is lazy and loaded. For non-lazy nodes always return true.
Return true if node is currently loading, i.e. a GET request is pending.
[ext-filter] Return true if this node is matched by current filter (or no filter is active).
Return true if this node is a temporarily generated status node of type 'paging'.
Return true if this node is a direct parent of other
.
(experimental) Return true if this node is partially loaded.
Return true if this node is partially selected (tri-state).
Return true if this node has DOM representaion, i.e. is displayed in the viewport.
Return true if this node has DOM representaion, i.e. is displayed in the viewport.
Return true if this node is the (invisible) system root node.
Return true if this node is selected, i.e. the checkbox is set.
undefined
if partly selected (tri-state), false otherwise.
Return true if this node is a temporarily generated system node like 'loading', 'paging', or 'error' (node.statusNodeType contains the type).
Return true if this a top level node, i.e. a direct child of the (invisible) system root node.
Return true if node is marked lazy but not yet loaded. For non-lazy nodes always return false.
Return true if all parent nodes are expanded. Note: this does not check whether the node is scrolled into the visible part of the screen or viewport.
Download data from the cloud, then call .update()
.
Load content of a lazy node. If the node is already loaded, nothing happens.
Optional
forceReload: boolean = falseIf true, reload even if already loaded.
Write to console.log
with node name as prefix if opts.debugLevel >= 4.
Write to console.debug
with node name as prefix if opts.debugLevel >= 4
and browser console level includes debug/verbose messages.
Write to console.error
with node name as prefix if opts.debugLevel >= 1.
Write to console.info
with node name as prefix if opts.debugLevel >= 3.
Write to console.warn
with node name as prefix if opts.debugLevel >= 2.
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: NavigateOptionsDelete this node and all descendants.
Remove all descendants of this node.
Remove all HTML markup from the DOM.
Remove all children, collapse, and set the lazy-flag, so that the lazyLoad event is triggered on next expand.
Renumber 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: ResetOrderOptionsMake 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: SetExpandedOptionsSet a new icon path or class.
Modify the check/uncheck state.
Optional
options: SetSelectedOptionsDisplay node status (ok, loading, error, noData) using styles and a dummy child node.
Optional
options: SetStatusOptionsRename this node.
Convenience method to implement column sorting.
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
Start editing this node's title.
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.
Internal
Return readable string representation for this instance.
Trigger modifyChild
event on node.parent(!).
Type of change: 'add', 'remove', 'rename', 'move', 'data', ...
Optional
extra: anyTrigger 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.
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.