Tree
new Tree(delegate, root, parentContainer, options)
Tree view control
Parameters
Methods
destroy()
Remove tree from DOM.
show(show)
Show/hide the tree control
Parameters
show* boolean | true to show the tree control, false to hide it |
getRootContainer()
Get the root container
Returns
type | description |
---|---|
string |
getElementForNode(node)
Get DOM element for a given logical tree node (or its integer id)
Parameters
node* object | Tree node element |
Returns
type | description |
---|---|
HTMLElement |
delegate()
Get the tree delegate
Returns
type | description |
---|---|
TreeDelegate |
isCollapsed(group)
Is the given group node in the tree collapsed?
Parameters
group* Object | The group node |
Returns
type | description |
---|---|
boolean | true if group node is collapsed, false if expanded |
setCollapsed(group, collapsed)
Collapse/expand the given group node in the tree
Parameters
group* Object | the group node |
collapsed* boolean | true to collapse the group node, false to expand it |
setAllCollapsed(collapsed)
Collapse/expand all group nodes in the tree
Parameters
collapsed* boolean | true to collapse tree, false to expand it |
addToSelection(nodes)
Add the given nodes to the current selection
Parameters
nodes* Array.<Object> | nodes to add to the current selection |
removeFromSelection(nodes)
Remove the given nodes from the current selection
Parameters
nodes* Array.<Object> | The nodes to remove from the current selection |
setSelection(nodes)
Set the current selection
Parameters
nodes* Array.<Object> | nodes to make currently selected |
clearSelection()
Clear the current selection
isSelected(node)
Is the given node selected?
Parameters
node* Object | The tree node |
Returns
type | description |
---|---|
boolean | true if node is selected, false otherwise |
scrollTo(node)
Scrolls the container to reveal the node’s DOM element.
Parameters
node* object | the Tree node |
addClass(node, className)
Add a CSS class to a node
Parameters
Returns
type | description |
---|---|
boolean | true if the class was added, false otherwise |
removeClass(node, className)
Remove a class from a node
Parameters
Returns
type | description |
---|---|
boolean | true if the class was removed, false otherwise |
hasClass(node, className)
Does the node have the given class?
Parameters
Returns
type | description |
---|---|
boolean | true if the node has the given class, false otherwise |
clear()
Clears the contents of the tree
iterate(node, callback)
Iterates through nodes in the tree in pre-order.