I have never used selectedIndex, because of the very flat vs hierarchical dichotomy you mentioned.
I have had good results using e4x XML as the dataProvider for my trees. Whe I need to select an item programmatically, I use an e4x selection expression to find the node, then set the selectedItem. I haven't used the openItems propety yet. Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Johannes Nel Sent: Tuesday, December 12, 2006 1:46 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] another bug in tree... or am I missing something when selecting something in a tree you get a treeevent, this has a refrence to the item in the dataprovider. On 12/12/06, hank williams < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: I dont quite understand. I am trying to set the selectedItem in the tree control. There is no concept of selection in the dataprovider so I dont know how I could set the set a selected item in the data vs the view. Selection is a view only concept. Hank On 12/12/06, Johannes Nel < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: use .item of the treeEvent to get the model and use selectedItem in the tree to set according to model. so what i am basically saying is do your iteration over the dataprovider and code according to the data vs the view. On 12/12/06, hank williams < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Here's the issue. You have a tree that has certain leaves open. You get a selectedIndex from a tree lets say its 9. This means that the 10th visible slot on the screen is selected, regardless of what is or isnt open. Its 10 rows from the top of the screen. Then, you put that captured selectedIndex back. Its 9. But now the 9 seem not to mean the 10th row, but the 10th item at the top level of the data structure. So if your first leaf in the tree is open and it has 10 children, you will be selecting the 20th row on the screen. In other words, reading a selectedIndex seems to be different from setting a selectedIndex. This is interesting also because it is very similar to my issue yesterday about the openItems being different when you read it than when you set it. It appears to me there are a bunch of issues in the tree control related to the fact that it is a heirarchical object being mapped to a flat underlying list structure. Another similar issue is that the iterators do not iterate over all the items in the tree, just the ones at the top level. An iterator that doesnt iterate over all the objects in the list doesnt seem to me to be very useful. I think all of this exposes some problems with the conceptual underpinnings of the tree object. I would love to hear if others have had similar issues. Hank -- j:pn http://www.lennel.org <http://www.lennel.org> -- j:pn http://www.lennel.org <http://www.lennel.org>