dperez <[EMAIL PROTECTED]> writes:

> I have this code to populate a treevirtual:
>     
>     var root = menu.getDataModel().addBranch(null, "Root", true);
>     // add more items
>     tree.getSelectionModel().setSelectionInterval(root, root);
>
> but I don't know how to initially select programmatically the root node.
> The code shown above selects the 1st child of the root node.
> What is the correspondence between nodeId and row numbers?
> Thanks in advance for any answer.

You may find low-level access useful.  You can obtain the whole array of nodes
with

  var nodeArr = tree.getDataModel().getData();

You can then iterate through the nodes.  Note that nodeArr is the COMPLETE
list of nodes, including those not currently visible.  The indexes are
therefore different than the selection indexes which include only the visible
elements.

Once you have the node array, you can do a recursive descent through the tree
using a node's 'children' property.  It's an array of node array indexes of
each of that node's children.

Note that the actual root of the tree, index 0, is a "virtual" node; it is
never displayed, and is there solely to provide a root of all other nodes.

For details of node properties, see the documentation of SimpleTreeDataModel.

After you make changes to nodes in the node array, call 

  tree.setData()

which causes the tree to be rerendered using the current node array.

Cheers,

Derrell

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to