This content has been marked as final. Show 2 replies
It will be more thatn a "scroll" though, you will have to open the branch(s) down to the previously selected node.
Look into the selectedItems array. I just am not sure that this will work if the tree has new data, since the refrences will no longer be valid.
You may have to do this manually, by saving an id for the selected node, then finding it and opening up the ancestor node chain after the dataProvider is reset.
This is not hard, especially with e4x. Here is an example that will get you partway:
Thanks for the reply. a few more details:
If the tree is large enough a scrollToIndex is required to scroll the node into view.
In the example on cflex, I quadrupled the size of the tree (to more closely match my application). When searching for a node near the bottom node was expanded but not visible. So I added:
var idx:int = myTree.selectedIndex;
Also in my application I am replacing the dataprovider with a new collection from the backend. So I also
needed to add: myTree.validateNow();
One more note: In the same tree I decided to implement a search function to allow users
to find specific nodes. during expandNode I would intermittantly get an ActionScript error.
We determined (with the help of Flex Support - thanks Peter) that a call to validateNow() was
needed while iterating and expanding the parent tree nodes.