larger context:
I have a small hierarchical tree (containing typically 5-20 items)
that I need to occasionally refresh when items are deleted/added. Not
a custom view; I add XUL DOM nodes manually per
http://developer.mozilla.org/en/docs/XUL_Tutorial:Trees. Each node has
some user data associated with it.
What I would like is that when the refresh happens, I'd like to figure
out which row (if any) has the focus via
tree.view.selection.currentIndex, get the user data from the DOM node,
then do my rebuild of the tree, and if the corresponding node exists
after the rebuild then I want to make sure that node is expanded & I
want to set the currentIndex to that node. (Note that the numerical
value of currentIndex can change if tree rows are added or deleted)
I'm confused about how to do this.
>Not a custom view; I add XUL DOM nodes manually per http://developer.mozilla.org/en/docs/XUL_Tutorial:Trees.
>
In that case the tree will automatically create a content view for you
(the other automatic view is a tree builder but that only applies when
using RDF and flags="dont-build-content"). The content view provides the
following extra methods:
nsIDOMElement getItemAtIndex(in long index);
long getIndexOfItem(in nsIDOMElement item);
item is either the <treeitem> or <treeseparator> element.
--
Warning: May contain traces of nuts.
ah! thanks!