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

NameTypegetsetDescripton
depthNumbercheckedReturns the depth of the tree
firstNodeBiSingelTreeNodecheckedReturns the first node of the tree
indentWidthNumbercheckedcheckedThe amount to indent child nodes
lastNodeBiSingleTreeNodecheckedReturns the last node of the tree
nodesBiSingleTreeNode[]checkedThe nodes in the tree
selectedNodeBiSingleTreeNodecheckedReturns the first selected node of the tree
showExpandIconBooleancheckedcheckedWhether to show the expand and collapse icons
sortFunctionfunctioncheckedcheckedThe 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.
useNativeScrollBarsBooleancheckedCustom scrollbars have not been implemented yet. Setting this property to false has no effect.

Methods

NameDescription
addNodeAdds a node to the tree
containsNodeReturns whether the node is contained in this tree.
getNodeAtReturns the node at a specific row index
getNodeAtPointReturns the node at the given point. If no node is found this returns null.
getRowForNodeReturns the row index for a node
hasNodesReturns whether the tree has any nodes
removeAllThis removes all the nodes
removeNodeRemoves a node item from the tree
sortSorts the nodes in the tree.

Events

NameTypeBubblesDescripton
changeBiEventFires when the selected items are changed
leaditemchangeBiEventFires 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

NameTypeOptionalDefaultDescripton
oChildBiSingleTreeNodeThe node to add
oBeforeBiSingleTreeNodecheckedOptional 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

NameTypeOptionalDefaultDescripton
oNodeBiSingleTreeNodeNode

Return Type

Boolean

getNodeAt

Returns the node at a specific row index

Syntax

object.getNodeAt ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberRow index

Return Type

BiSingleTreeNode

getNodeAtPoint

Returns the node at the given point. If no node is found this returns null.

Syntax

object.getNodeAtPoint ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe left position relative to the browser window
yNumberThe top position relative to the browser window

Return Type

BiSingleTreeNode

getRowForNode

Returns the row index for a node

Syntax

object.getRowForNode ( oNode )

Parameters

NameTypeOptionalDefaultDescripton
oNodeBiSingleTreeNodeNode 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

NameTypeOptionalDefaultDescripton
oChildBiSingleTreeNodeThe node to remove

Return Type

BiSingleTreeNode

sort

Sorts the nodes in the tree.

Syntax

object.sort ( bAscending )

Parameters

NameTypeOptionalDefaultDescripton
bAscendingBooleanWhether to sort ascending or not

Return Type

void