I didn't quite follow Ryan's suggestion.

 

The problem in general is that the selectdItems array has to contain
references to items in the dataProvider.  This will not be the case if
your replace the DataProvider.

 

Using the API to update changed items is an ideal solution if possible
in your case.

 

Another solution would be to keep a list of ids of the open nodes.  You
only need to keep the end child in the list.  Then, when the
dataProvider is refreshed, recursively process the dataProvider looking
for ids in the list.  When found, climb the ancestor chain opening nodes
as you go until you reach an open node or root.

 

Really ugly, but pretty fast if your data is not huge.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Gravener
Sent: Thursday, September 25, 2008 1:59 PM
To: [email protected]
Subject: Re: [flexcoders] Re: Tree Component openItems and refresh
dataProvider issue

 

override the set dataProvider;

then store the openitems, selecteditems, etc...

call
super.dataProvider = provider;
openItems=storedOpenItems;
validateNow();
selectedItems=storedSelectedItems;
validateNow();

as for amf calls, I have a method which gets the instance from the
dataprovider
and adds it to an array.  then i set the value in the tree.

Ryan Gravener
http://twitter.com/ryangravener <http://twitter.com/ryangravener> 



On Thu, Sep 25, 2008 at 1:41 PM, Ivo <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Are you resetting the data provider or just updating it? I find that
if I just update the data provider by inserting/removing elements the
Tree reflects the change appropriately.

One bug I've hit, which might be what you are experiencing, is that if
I remove the Tree from the stage and add it later then all branches
will appear collapsed even tho the property openItems correctly lists
the open nodes. The workaround is similar to what you describe:

https://bugs.adobe.com/jira/browse/SDK-14892
<https://bugs.adobe.com/jira/browse/SDK-14892> 

 

 

Reply via email to