Hi!
I had a similar problem and I had to set preserveToggle="false" so that
tree get collapsed after each request.
I hope it helps you.
regards,
JuanCarlos
Bill Schneider wrote:
I am trying to implement a page with the tree2 tag in which clicking on
a node in the tree redraws the tree with a new root.
I have things almost working except for breakage with expansion state.
Somehow I am unable to wipe the current expansion state after building
the new tree model with the new root after selection. This often
results in an "illogical state" / "Node is expanded but it is also
considered a leaf..." error.
I am using request scope for my managed bean and client-side state
saving. My JSP looks something like this:
<t:tree2 value="#{bean.tree}" var="node" binding="theTree" ....>
<f:facet...>
<h:commandLink action="#{bean.changeRoot}"> ... </h:commandLink>
</f:facet...>
</t:tree2>
and my controller looks something like this:
public class Bean {
private HtmlTree _theTree; //+getters/setters
private TreeNode _root;
private TreeModel _model;
public TreeModel getTree() {
_model = new TreeModelBase(... data from root ...);
return _model;
}
public void changeRoot() {
TreeNode newRoot = _theTree.getNode();
_root = newRoot;
_model = new TreeModelBase(... newRoot ..);
// somehow need to wipe expansion state
_model.setTreeState(new TreeStateBase());
}
}
It seems like providing a fresh TreeStateBase object should wipe the
current expansion state but this doesn't seem to help. Any ideas for
what I might be missing here?
Thanks in advance,
-- Bill