Class: Tree

vef.ui.Tree(target, items, structure)

Generic Tree Class to display hierarchical structures item = { title: string, icon: [string], active: boolean, expanded: boolean } structure = { "#": [children_ids], "parent_id": [children_ids], ... } items = { "id": item, ... }

Constructor

new Tree(target, items, structure)

Parameters:
Name Type Description
target HTMLElement | string
items object
structure object
Source:

Methods

addFolder(parent, id, item)

Parameters:
Name Type Description
parent string
id string
item object
Source:

addItem(parent, id, item)

Parameters:
Name Type Description
parent string
id string
item object
Source:

addStructuredItems(items, structure, root)

Parameters:
Name Type Description
items object
structure object
root string element to append item tree to (default = "#")
Source:

clear()

Clear all items from tree
Source:

deselect(id)

deselect an item
Parameters:
Name Type Description
id *
Source:

deselectAll()

Deselect all items
Source:

getItems(selected) → {object}

Parameters:
Name Type Default Description
selected boolean false only get selected layers
Source:
Returns:
items
Type
object

getStructure(selected) → {object}

Parameters:
Name Type Default Description
selected boolean false only get selected layers
Source:
Returns:
structure
Type
object

select(id)

select an item
Parameters:
Name Type Description
id string
Source:

selectAll()

Select all items
Source:

toggle(id)

swap the state of an item to the opposite. partly selected items will also be deselected.
Parameters:
Name Type Description
id string
Source: