Examples

Operations

All of the examples on this page, are built on the predefined JSON example from the data sources demo.

Selecting nodes

The user can select nodes by clicking on them (in this example if Ctrl is held multiple nodes can be selected).

You can define a node to be selected onload by using the selected config setting (check documentation for more).

The get_* functions are most useful for keyboard shortcuts - they can move either the hover or selected states - this is defined using the ui.hover_mode config setting or using the force argument in each of the functions.

Creating nodes

You can create nodes programatically with the create function. You can place the new node inside another node (even at a specific position among its children) or "below" or "after" the node (if you omit the reference node, the currently selected is used). This is controlled by the rules.createat config option, and the third argument of the create function.