Yes, please, that title is a bit offensive.

 

If your data was xml, and you had unique id's on the leaf noded, this
would be pretty easy.  Just maintain a list of visible (ancestor chain
is open) leaf node ids.  To restore the tree, loop over that list, using
e4x to find the node, then use parent() in a loop to climb back up the
tree, opening nodes as you go, until you reach an open node or the root.

 

If that won't work for you then you might have to store a set of
delimited paths, then to restore the tree, parse the paths to navigate
to and open each node.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Schmalle
Sent: Wednesday, October 01, 2008 9:15 AM
To: [email protected]
Subject: Re: [flexcoders] The Tree component sux but .... I need help :)

 

Matthew,

 

The Tree component doesn't suck that bad, try a different title.

 

I'll answer your question though, openItems uses references(unique
id's), it's not majik man. You have to understand instance references,
then you can say the Tree doesn't suck, I just didn't understand it.

 

This is the key, right here;

 

_openItems[itemToUID(item)] = item;

 

What this means is, if you do not supply the items with the same
instance(unique), this property will never work.

 

Sounds like you need to do a little leg work and save the state of your
tree before you set the dataProvider, then create a new openItems Array
with the current instances that ARE IN the tree.

 

What kind of objects are held in your dataProvider? ... Object, or a
custom model class?

 

Mike

On Tue, Sep 30, 2008 at 6:16 PM, flashalisious <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

I have a Tree Component that I have bound an ArrayCollection of data
too.

The tree will have two branches. each branch will have several
children. Basically a list of files. So the user will upload a new
file by clicking an browsing for a new file.

I then as AMFPHP to give the list of files again and update the
ArrayCollection with new data. Before I ask for the new
ArrayCollection of data I store the try components open items like this

tempOpenItems = mytree.openItems;

after the new data is set I then would like to say 

mytree.openItems = tempOpenItems;

this does not work.

Has anyone figured out how to add new data to the Tree dataProvider
and maintain the Trees view state of open Items?

thanks,
matthew




-- 
Teoti Graphix, LLC
http://www.teotigraphix.com <http://www.teotigraphix.com> 

Teoti Graphix Blog
http://www.blog.teotigraphix.com <http://www.blog.teotigraphix.com> 

You can find more by solving the problem then by 'asking the question'.

 

Reply via email to