I have drawn a tree structure using TreeField
in Blackberry now . The root node consists of 15 nodes and every node has its corresponding child nodes and on running the application , all the node comes as expanded . I need only a particular node to be expanded and all the others as collapsed .
I have tried using the following method from apis .
myTree.setDefaultExpanded(false);
and
myTree.setExpanded(1, true);
but does not seem to have any effect so far on the tree . All nodes comes as expanded on launching the application .
If you look at the documentation for TreeField, you'll see that
setDefaultExpanded()
must be called before you add the nodes, not just before they are displayed:So, to modify the TreeField example, you'd do something like this: