-
currentIndex
- Type: integer
-
Set to the row index of the tree caret in the
tree
. For trees with focus, the caret's position is indicated by the focus ring, but unfocused trees won't show a focus ring, naturally. For unfocused trees, the (undrawn) caret's position can still be obtained by this property. If the caret isn't present for any row (for example, because the tree has never been focused), the value will be-1
.You cannot rely on this property to change or determine a tree selection, except for trees with
. (All trees haveseltype
="single"seltype="multiple"
by default.) To reliably change or determine a selection, instead use thensITreeSelection
interface methods available viatree.view.selection
.
Example
// One way of retrieving the text of a cell. <script language ="javascript"> function treeRowClicked(){ var tree = document.getElementById("my-tree"); var selection = tree.view.selection; var cellText = tree.view.getCellText(tree.currentIndex, tree.columns.getColumnAt(0)); alert(cellText); } </script> <tree id="my-tree" seltype="single" onselect="treeRowClicked()"> <treecols> <treecol label="Title" flex="1"/><treecol label="URL" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="[email protected]"/> <treecell label="Top secret plans"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="[email protected]"/> <treecell label="Let's do lunch"/> </treerow> </treeitem> </treechildren> </tree>
See also
Document Tags and Contributors
Tags:
Contributors to this page:
Sheppy,
trevorh,
Sevenspade,
Marsf,
MarkFinkle,
Ptak82,
Pmash,
The Hunter,
Dria
Last updated by:
Sheppy,