A container which can be used to hold a tabular or hierarchical set of rows of elements. The tree may contain any number of rows and any number of columns. Each row of the tree may contain child rows which are displayed indented from the parent. The contents of a tree are most commonly generated from an RDF datasource.
The example below creates a tree with two columns are three rows. In addition, a header bar is displayed.
Example:
<tree id="menu" flex="1">
<treehead>
<treerow>
<treecell label="Breakfast"/>
<treecell label="Lunch"/>
</treerow>
</treehead>
<treechildren flex="1">
<treeitem>
<treerow>
<treecell label="Cheese Omelet"/>
<treecell label="Ham Sandwich"/>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell label="Waffles"/>
<treecell label="Caesar Salad"/>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell label="Grapefruit"/>
<treecell label="Cheeseburger"/>
</treerow>
</treeitem>
</treechildren>
</tree>
Attributes:
Attributes inherited from XUL Element
If true, the tree allows multiple items to be selected at once.
Properties and Methods:
Properties and Methods inherited from XUL Element
Adds the specified treeitem to the set of currently selected set of items.
Unselects any selected treeitems in the tree.
If the element in the tree is not currently visible to the user, the tree view is scrolled so that it is. If the treeitem is already visible, no scrolling occurs. If the element is not in the tree, nothing happens.
If the treeitem at the specified index is not currently visible to the user, the tree view is scrolled so that it is. If the treeitem is already visible, no scrolling occurs.
Returns the index of the first displayed row in the tree. This is not the same as the first row. If the view of the tree has been scrolled down, the function can be used to retrieve the index of the first row that the user can see.
Returns the zero-based position of the given treeitem item. Items are numbered starting from the first treeitem displayed in the tree. Child items are included in place as part of the count. That is, if the first treeitem contains three treeitems as children and the second treeitem contains five, there are a total of 10 treeitems. The first outer treeitem is numbered 0, its three children 1, 2 and 3, the second outer treeitem is numbered 4 and its 5 children are numbered 5 to 9.
An exception is thrown if the item is not in the tree.
Returns the treeitem node that is at the position specified by the parameter index in the tree.
This method returns a treeitem after another one. The parameter startItem is the treeitem and delta is the number of treeitems to count to.
getNextItem ( tItem, 2 );
This example, given a treeitem titem, will return the treeitem 2 items after it, or null if no such item exists.
Returns the number of rows of the tree that are currently visible to the user.
This method returns a treeitem before another one. The parameter startItem is the treeitem and delta is the number of treeitems to count to.
getPreviousItem ( tItem, 5 );
This example, given a treeitem titem, will return the treeitem 5 items before it, or null if no such item exists.
Returns the total number of rows in the tree.
Removes the specified treeitem from the set of currently selected set of items. Thus, the item in unselected but other selected items remain selected.
Scrolls the tree view to the specified index. This is different than ensureIndexIsVisible because the view is always scrolled.
Selects the treeitem specified by item. All other items are unselected.
Returns the index of the first selected item in the tree. You can select a single item via its index by setting this property.
An array of the treeitems that are currently selected. If no items are selected, the array with have zero length.
If the specified treeitem is selected, it is unselected. If it is not selected, it is selected. Other items in the tree that are selected are not affected, and retain their selected state.