XULTreeViewRecord Prototype

A single entry in an XULTreeView.

Syntax

var object = new XULTreeViewRecord(share);

Arguments

ArgumentSummary
share An otherwise empty object to store cache data. You should use the same object as the share for the XULTreeView that you indend to contain these records.

Remarks

These things take care of keeping the XULTreeView properly informed of changes in value and child count. You shouldn't have to maintain tree state at all - just update the XULTreeViewRecord objects.

Members

MemberSummary
appendChild add a child to the end of the child list for this record. takes care of updating the tree as well.
appendChildren add a list of children to the end of the child list for this record. faster than multiple appendChild() calls.
calculateVisualRow calculate the "visual" row for this record. If the record isn't actually visible return -1. eg. Name Visual Row node1 0
close close this record, hiding it's children. DONT call this method if the record has no children, or if it is already closed.
findContainerTree walk the parent tree to find our tree container. return null if there is none
hide hide this record and all descendants.
invalidate invalidate this row in the tree
invalidateCache invalidate any data in the cache.
locateChildByVisualRow locates the child record for the visible row targetRow. DO NOT call this with a targetRow less than this record's visual row, or greater than this record's visual row + the number of visible children it has.
onVisualFootprintChanged called when a node above this one grows or shrinks. we need to adjust our own visualFootprint to match the change, and pass the message on.
open open this record, exposing it's children. DONT call this method if the record has no children.
reSort this method will cause all child records to be reSorted. any records with the default sortCompare method will be sorted by the colID passed to setSortColumn.
removeChildAtIndex remove a child from this record. updates the tree too. DONT call this with an index not actually contained by this record.
reserveChildren call this to indicate that this node may have children at one point. make sure to call it before adding your first child.
setColumnPropertyName associates a property name on this record, with a column in the tree. This method will set up a get/set pair for the property name you specify which will take care of updating the tree when the value changes. DO NOT try to change your mind later. Do not attach a different name to the same colID, and do not rename the colID. You have been warned.
setColumnPropertyValue
setSortColumn set the default sort column and reSort.
setSortDirection set the default sort direction. 1 is ascending, -1 is descending, 0 is no sort. setting this to 0 will not recover the natural insertion order, it will only affect newly added items.
unHide unhide this record and all descendants.

See Also

Source Code

function XULTreeViewRecord(share)
{
this._share = share;
this.visualFootprint = 1;
this.isHidden = true; /* records are considered hidden until they are
* inserted into a live tree */
}