Nightly releases are generated automatically from the latest source code and are intended for experimental purposes only.
These builds may contain incomplete or untested features, bugs, or security vulnerabilities, and as such, are not for production use.
Users should be aware that nightly releases may cause unexpected behavior, data loss, or system instability.
Use of these releases is at the user's own risk, and it is advised to have adequate backups before testing.
The software is provided as is with no guarantees or support.
The SelectionAPI provides basic functionalities to manipulate the current selection of nodes.
It allows adding, removing, and checking the selection status of nodes, as well as replacing the current selection.
Quick Start
Example: add a node to the selection, query the selection, and clear the selection in the end.
constcontext = webvis.getContext()// add node with ID 5 to the selectionawaitcontext.addToSelection(5)// get selected nodescontext.getSelectedNodes() // returns [5]// clear the selectionawaitcontext.clearSelection()
Reading the selection state of a node
Instead of using the isSelected method,
you can also check whether a node is selected by using the getProperty method.
The property Property.SELECTED can be used to check the selection state of a node.
The selection state is recursive, meaning:
When a parent node is selected, all its children are selected as well.
When all children of a node become selected, the parent node is considered selected.
The getSelectedNodes method returns the list of selected nodes. If a parent node is selected, it will return the parent node, but not its children.
To get a list of all selected leaf nodes (nodes without children), you can use the getSelectedLeafNodes method.
Events
The following event is associated with the SelectionAPI:
An array which contains the IDs of all leaf nodes in the current selection.
getSelectedNodes
getSelectedNodes():number[]
Returns a list of all selected nodes.
When a whole subtree is selected, only the parent node will be included in the returned array.
To get the selected leaf nodes of the subtree, use getSelectedLeafNodes instead.
Returns number[]
An array which contains the IDs of all nodes in the current selection.
getSelection
getSelection():Promise<number[]>
Returns a list of all selected nodes.
Returns Promise<number[]>
An array which contains the IDs of all nodes in the current selection.
Deprecated
getSelection is deprecated, please use getSelectedNodes instead.
Selected nodes will be unselected, and then all previously unselected leaf nodes will be selected.
When all child nodes of a parent are selected, the selection moves up the hierarchy as usual.
If the initial selection is only Node 2.1, calling invertSelection will result in the selection including Node 2.2, Node 1.1, Node 1.2, and therefore also Node 1.
Node 0 and Node 2 will not become selected, even though they were not selected initially.
If getSelectedNodes is called at this point, it will return [Node 1, Node 2.2].
SelectionAPI
Overview
The SelectionAPI provides basic functionalities to manipulate the current selection of nodes. It allows adding, removing, and checking the selection status of nodes, as well as replacing the current selection.
Quick Start
Example: add a node to the selection, query the selection, and clear the selection in the end.
Reading the selection state of a node
Instead of using the isSelected method, you can also check whether a node is selected by using the getProperty method. The property Property.SELECTED can be used to check the selection state of a node.
The selection state is recursive, meaning:
The getSelectedNodes method returns the list of selected nodes. If a parent node is selected, it will return the parent node, but not its children.
To get a list of all selected leaf nodes (nodes without children), you can use the getSelectedLeafNodes method.
Events
The following event is associated with the SelectionAPI: