I am using the tree2 in Myfaces and my requirement is to get the data from the database and build the tree nodes every time a node is expanded. If an expanded node is collapsed I want to remove the nodes under this node from the tree and add the nodes afresh by getting the data from the database when that node is expanded again.

 

I am facing the problem that even if I remove the child nodes of the node that I collapse, when I add the nodes again when I expand that node it seems to remember the state of the child nodes before I collapsed the parent node and removed these child nodes. So if I had a child node which was expanded before I removed it, the next time I expand the parent node and add these child nodes and I click on this child node that was expanded it will not expand on the first click as it was expanded when I removed this node. On the second click It expands. I believe it is collapsing the state on the first click and on the second click it is then expanding. How do I remove the state of the child nodes that I remove from the tree.

 

I use…..

 

List children = node.getChildren();

Children.removeAll(children);

 

…. to remove the nodes. Is there another better way to remove the nodes or am I doing it correctly. IF this is correct then how do I remove the states of the nodes the tree maintains.

 

Any help is much appreciated.

 

 

 


**********************************************************************
Please be aware that, notwithstanding the fact that the person sending
this communication has an address in Bear Stearns' e-mail system, this
person is not an employee, agent or representative of Bear Stearns.
Accordingly, this person has no power or authority to represent, make
any recommendation, solicitation, offer or statements or disclose
information on behalf of or in any way bind Bear Stearns or any of its
affiliates.
**********************************************************************

Reply via email to