jsTree v.1.0 - UI plugin

Description

The UI plugin handles selecting, deselecting and hovering tree items.

Configuration

select_limit

A number. Default is -1.

Defines how many nodes can be selected at a given time (-1 means unlimited).

select_multiple_modifier

A string. Default is "ctrl".

The special key used to make a click add to the selection and not replace it ("ctrl", "shift", "alt", "meta").
You can also set this to "on" making every click add to the selection.

selected_parent_close

A string (or false). Default is "select_parent".

What action to take when a selected node's parent is closed (making the selected node invisible). Possible values are false - do nothing, "select_parent" - select the closed node's parent and "deselect" - deselect the node.

select_prev_on_delete

A boolean. Default is true.

If set to true when a selected node is deleted, its previous sibling (or parent) is selected.

disable_selecting_children

A boolean. Default is false.

If set to true you will not be able to select children of already selected nodes.

initially_select

An array. Default is [].

Defines which nodes are to be automatically selected when the tree finishes loading - a list of IDs is expected.

Demos

Using the UI plugin

API

._get_node ( node , allow_multiple )

Overrides the function form the core module.
if node is undefined or null and allow_multiple is true all the currently selected nodes are returned
if node is undefined or null and allow_multiple is NOT true only the last selected node is returned.

.save_selected ( )

Saves away the current selection state of the tree (saves it in a variable, so do not expect a restore after a refresh - for that functionality refer to the cookies plugin. Used mostly internally. Triggers an event.

.reselect ( )

Restores the state of the tree using the variable saved in the above function. Used mostly internally. Triggers an event.

.refresh ( node )

Overrides the function form the core module.
Enables saving the selection state before the refresh and restoring it afterwards.

.hover_node ( node )

Sets the specified node as hovered. Triggers an event.

.dehover_node ( )

Removes the hover state from the currently hovered node (if there is one). Triggers an event.

.select_node ( node , check , event )

 

.deselect_node ( node ), .toggle_select ( node )

There functions control the selected state on a node. deselect_node triggers an event.

.deselect_all ( context )

Deselects all selected nodes. If context is set - only the selected nodes within that context are deselected. Triggers an event.

.get_selected ( context )

Returns all selected nodes. If context is set - only the selected nodes within that context are returned.

.is_selected ( node )

Returns whether the specified node is selected or not.