class SAPO.Ink.TreeView
Authors:
jose.p.dias AT co.sapo.pt
Version:
0.1
 Displays a tree structure. Uses unordered lists internally.
 Supports multi-root trees by keeping hidden a '' valued root upwards.

 Each node in the model is an array:
 - index 0 is its value (a String)
 - index 1 is an optional array of child nodes
 - index 2 is optional. if trueish collapses its children
 this structure is recursive.

 Every node can be referenced by index. An index is an array of integers, going down the free from its root.
 
Since:
October 2012
Defined in Ink/TreeView/0.1/lib.js

Constructor Summary
TreeView (String|DOMElement selector, Object options)

Function Summary
collapses all non-leaf nodes
unregisters the component and removes its markup from the DOM
expands all non-leaf nodes
returns a copy of the model
String getNodeValue (Number[] index)
returns the node value, given its index
toggleNode (Number[] index)
toggles the node given its index

Constructor Details

constructor TreeView

TreeView(String|DOMElement selector, Object options)
Parameters:
selector
options
  • [ Boolean selectable ]
  • [ Boolean startsCollapsed ]
  • [ Function onClick ]

Function Details

function collapseTree

collapseTree()
collapses all non-leaf nodes

function destroy

destroy()
unregisters the component and removes its markup from the DOM

function expandTree

expandTree()
expands all non-leaf nodes

function getModel

String[] getModel()
returns a copy of the model

function getNodeValue

String getNodeValue(Number[] index)
returns the node value, given its index
Parameters:
index

function toggleNode

toggleNode(Number[] index)
toggles the node given its index
Parameters:
index