BiSingleTree
A Simple one column Tree.
This class extends BiTreeView and therefore all methods and fields available for BiTreeView are also available for BiSingleTree .
Constructor
new BiSingleTree ( )
Parameters
No parameters.
Properties
| Name | Type | get | set | Descripton |
depth | Number | ![]() | Returns the depth of the tree | |
firstNode | | ![]() | Returns the first node of the tree | |
indentWidth | Number | ![]() | ![]() | The amount to indent child nodes |
lastNode | | ![]() | Returns the last node of the tree | |
nodes | | ![]() | The nodes in the tree | |
selectedNode | | ![]() | Returns the first selected node of the tree | |
showExpandIcon | Boolean | ![]() | ![]() | Whether to show the expand and collapse icons |
sortFunction | function | ![]() | ![]() | The sort function to use. The function is passed the two nodes to compare as arguments, to compare the value (text) of the node use getData() on the node. Defaults to case sensitive string compare. |
useNativeScrollBars | Boolean | ![]() | Custom scrollbars have not been implemented yet. Setting this property to false has no effect. |
Methods
| Name | Description |
addNode | Adds a node to the tree |
containsNode | Returns whether the node is contained in this tree. |
getNodeAt | Returns the node at a specific row index |
getNodeAtPoint | Returns the node at the given point. If no node is found this returns null. |
getRowForNode | Returns the row index for a node |
hasNodes | Returns whether the tree has any nodes |
removeAll | This removes all the nodes |
removeNode | Removes a node item from the tree |
sort | Sorts the nodes in the tree. |
Events
| Name | Type | Bubbles | Descripton |
change | | Fires when the selected items are changed | |
leaditemchange | | Fires when the lead item is changed |
Static Methods
None.
Static Fields
None.
Remarks
BiSingleTree introduces a few changes in the theme.css file. User defined themes will need to be updated with these changes for the single tree selection to render consistent with the theme. In the 'tree view' section the following is new: // New tag .bi-tree-view-table span { <-- new row padding-left: 1px; <-- new row padding-right: 1px; <-- new row } // Added span to the following tags .bi-tree-view-table span.selected, <-- new row .bi-tree-view-table .selected td, .bi-tree-view-table td.selected { background-color: ThreeDFace !important; } .bi-tree-view-table .focused span.selected, <-- new row .bi-tree-view-table .focused .selected td, .bi-tree-view-table .focused td.selected { color: HighlightText !important; background-color: Highlight !important; } .bi-tree-view-table .focused span.lead, <-- new row .bi-tree-view-table .focused .lead td, .bi-tree-view-table .focused td.lead { border-top: 1px solid ThreeDShadow !important; border-bottom: 1px solid ThreeDShadow !important; padding-top: 0 !important; padding-bottom: 0 !important; }
Method Details
addNode
Adds a node to the tree
Syntax
object.addNode ( oChild [ ,oBefore ] ) Parameters
| Name | Type | Optional | Default | Descripton |
oChild | | The node to add | ||
oBefore | | ![]() | Optional argument telling what node to insert before |
Return Type
void
containsNode
Returns whether the node is contained in this tree.
Syntax
object.containsNode ( oNode ) Parameters
| Name | Type | Optional | Default | Descripton |
oNode | | Node |
Return Type
Boolean
getNodeAt
Returns the node at a specific row index
Syntax
object.getNodeAt ( y ) Parameters
| Name | Type | Optional | Default | Descripton |
y | Number | Row index |
Return Type
getNodeAtPoint
Returns the node at the given point. If no node is found this returns null.
Syntax
object.getNodeAtPoint ( x,y ) Parameters
| Name | Type | Optional | Default | Descripton |
x | Number | The left position relative to the browser window | ||
y | Number | The top position relative to the browser window |
Return Type
getRowForNode
Returns the row index for a node
Syntax
object.getRowForNode ( oNode ) Parameters
| Name | Type | Optional | Default | Descripton |
oNode | | Node to find row for |
Return Type
Number
hasNodes
Returns whether the tree has any nodes
Syntax
object.hasNodes ( ) Parameters
No arguments.
Return Type
Boolean
removeAll
This removes all the nodes
Syntax
object.removeAll ( ) Parameters
No arguments.
Return Type
void
removeNode
Removes a node item from the tree
Syntax
object.removeNode ( oChild ) Parameters
| Name | Type | Optional | Default | Descripton |
oChild | | The node to remove |
Return Type
sort
Sorts the nodes in the tree.
Syntax
object.sort ( bAscending ) Parameters
| Name | Type | Optional | Default | Descripton |
bAscending | Boolean | Whether to sort ascending or not |
Return Type
void
