#

API Docs for: 3.10.3
Show: Inherited Protected Private Deprecated

# Tree.Openable Class

Defined in: `tree/js/extensions/tree-openable.js:11`
Module: tree-openable
Parent Module: tree

Extension for `Tree` that adds the concept of open/closed state for nodes.

## Constructor

### `Tree.Openable`

()

Defined in `tree/js/extensions/tree-openable.js:11`

- Index
- Methods
- Events

## Item Index

### Methods

- _defCloseFn
- _defOpenFn
- closeNode
- openNode
- toggleOpenNode

### Events

- close
- open

## Methods

### `_defCloseFn`

(

- `e`

)
protected

Defined in `tree/js/extensions/tree-openable.js:125`

Default handler for the `close` event.

#### Parameters:

- `e` EventFacade

### `_defOpenFn`

(

- `e`

)
protected

Defined in `tree/js/extensions/tree-openable.js:136`

Default handler for the `open` event.

#### Parameters:

- `e` EventFacade

### `closeNode`

(

- `[options]`

)
chainable

Defined in `tree/js/extensions/tree-openable.js:49`

Closes the specified node if it isn't already closed.

#### Parameters:

- `[options]` Object optional

  Options.

  - `[silent=false]` Boolean optional

    If `true`, the `close` 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.

### `openNode`

(

- `[options]`

)
chainable

Defined in `tree/js/extensions/tree-openable.js:76`

Opens the specified node if it isn't already open.

#### Parameters:

- `[options]` Object optional

  Options.

  - `[silent=false]` Boolean optional

    If `true`, the `open` 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.

### `toggleOpenNode`

(

- `node`
- `[options]`

)
chainable

Defined in `tree/js/extensions/tree-openable.js:103`

Toggles the open/closed state of the specified node, closing it if it's currently open or opening it if it's currently closed.

#### Parameters:

- `node` Tree.Node

  Node to toggle.

- `[options]` Object optional

  Options.

  - `[silent=false]` Boolean optional

    If `true`, events 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.

## Events

### `close`

Defined in `tree/js/extensions/tree-openable.js:19`

Fired when a node is closed.

#### Event Payload:

- `node` Tree.Node

  Node being closed.

- `src` String

  Source of the event.

### `open`

Defined in `tree/js/extensions/tree-openable.js:29`

Fired when a node is opened.

#### Event Payload:

- `node` Tree.Node

  Node being opened.

- `src` String

  Source of the event.