This content has been marked as final. Show 2 replies
Assigning the dataProvider will always cause the tree to be completely re-rendered, and will initialize the nodes to their default disclosure state.
You have two options in 1.5 (2.0 makes this much easier):
1. Keep track of the open status of the nodes, by storing some key that will identify that node. After the tree is re-rendered, recursively travel every node, searching for the open branches. When you find one, climb back up the tree, opening each node as yo go until you reach the root. If you are careful you can make this pretty efficient, because you only need to store-restore the open state of the last open node in the branch, since all of its parents must be also open.
2. Do not re-assign the dataprovider. Instead use the dataProvider methods to update the dataProvider. This should make the tree respond visually, without completely re-rendering. This might be more difficult.
Since I only needed to restore a single, selected node, I used the first option. The second would be much more efficient and long term flexible if you can make it work.
In flex 2.0, you just save the array "selectedItems", then assign that array back to selectedItems to restore the state. Cool, huh?
thank you very much for help. sometimes to know you can not do somthing is as helpful as knowing how to do it!
i my try to go with my own seletedItems structure, so i can reopen opened brunches.
we are stuck with 1.5 as my boss said :-( - 2 2 big a change, uncharted grounds...
P.S three = 3 not a tree and i am sorry for mistake