#

API Docs for: 3.10.3
Show: Inherited Protected Private Deprecated

# Tree.Selectable Class

Defined in: `tree/js/extensions/tree-selectable.js:13`
Module: tree-selectable
Parent Module: tree

Extension for `Tree` that adds the concept of selection state for nodes.

## Constructor

### `Tree.Selectable`

()

Defined in `tree/js/extensions/tree-selectable.js:13`

- Index
- Methods
- Properties
- Attributes
- Events

## Item Index

### Methods

- getSelectedNodes
- selectNode
- unselect
- unselectNode

### Properties

- _selectedMap

### Attributes

- multiSelect

### Events

- select
- unselect

## Methods

### `getSelectedNodes`

() Tree.Node.Selectable[]

Defined in `tree/js/extensions/tree-selectable.js:75`

Returns an array of nodes that are currently selected.

#### Returns:

Tree.Node.Selectable[]: Array of selected nodes.

### `selectNode`

(

- `node`
- `[options]`

)
chainable

Defined in `tree/js/extensions/tree-selectable.js:85`

Selects the specified node.

#### Parameters:

- `node` Tree.Node.Selectable

  Node to select.

- `[options]` Object optional

  Options.

  - `[silent=false]` Boolean optional

    If `true`, the `select` event will be suppressed.

  - `[src]` String optional

    Source of the change, to be passed along to the event facade of the resulting event. This can be used to distinguish between changes triggered by a user and changes triggered programmatically, for example.

### `unselect`

(

- `[options]`

)
chainable

Defined in `tree/js/extensions/tree-selectable.js:117`

Unselects all selected nodes.

#### Parameters:

- `[options]` Object optional

  Options.

  - `[silent=false]` Boolean optional

    If `true`, the `unselect` event will be suppressed.

  - `[src]` String optional

    Source of the change, to be passed along to the event facade of the resulting event. This can be used to distinguish between changes triggered by a user and changes triggered programmatically, for example.

### `unselectNode`

(

- `node`
- `[options]`

)
chainable

Defined in `tree/js/extensions/tree-selectable.js:140`

Unselects the specified node.

#### Parameters:

- `node` Tree.Node.Selectable

  Node to unselect.

- `[options]` Object optional

  Options.

  - `[silent=false]` Boolean optional

    If `true`, the `unselect` event will be suppressed.

  - `[src]` String optional

    Source of the change, to be passed along to the event facade of the resulting event. This can be used to distinguish between changes triggered by a user and changes triggered programmatically, for example.

## Properties

### `_selectedMap`

Object protected

Defined in `tree/js/extensions/tree-selectable.js:44`

Mapping of node ids to node instances for nodes in this tree that are currently selected.

## Attributes

### `multiSelect`

Boolean

Defined in `tree/js/extensions/tree-selectable.js:207`

Whether or not to allow multiple nodes to be selected at once.

Default: false

#### Fires event `multiSelectChange`

Fires when the value for the configuration attribute `multiSelect` is changed. You can listen for the event using the `on` method if you wish to be notified before the attribute's value has changed, or using the `after` method if you wish to be notified after the attribute's value has changed.

#### Parameters:

- `e` EventFacade
  An Event Facade object with the following attribute-specific properties added:
  - `prevVal` Any
    The value of the attribute, prior to it being set.
  - `newVal` Any
    The value the attribute is to be set to.
  - `attrName` String
    The name of the attribute being set.
  - `subAttrName` String
    If setting a property within the attribute's value, the name of the sub-attribute property being set.

## Events

### `select`

Defined in `tree/js/extensions/tree-selectable.js:21`

Fired when a node is selected.

#### Event Payload:

- `node` Tree.Node

  Node being selected.

### `unselect`

Defined in `tree/js/extensions/tree-selectable.js:30`

Fired when a node is unselected.

#### Event Payload:

- `node` Tree.Node

  Node being unselected.