You said that last time, and I still don't know what it means to change on the basis of an id attribute. I am recommending you not use {} to assign the dataprovider if possible. If you are changing the xml, you may need to cal validateNow before calling expandItem.
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Baljeet singh Sent: Wednesday, September 05, 2007 11:07 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Tree collapses when dataProvider for tree changes Hi, Thanks for suggestion. But dataProvider has to be changed, & accordingly tree changes. Considering XML as tree of nodes, I am retrieving that particular node when dataProvider changes on the basis of "id" attribute . Each node is going to have unique value for "id" atribute in XML String. By this way i gets a XML object. That XML object is used for expandItem() method or for selectedItem attribute. Thanks & Regards, Baljeet --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Where the XML comes from shouldn't matter. Think of XML as a tree of > nodes each with a unique id (UID). The Tree tracks the UIDs of nodes > that are open. > > If you change the XML enough, the set of nodes, even if they look the > same, may have new UIDs and thus the set of open items and calls to > expandItem may not work. > > Also note that if you bind to the XMLListCollection, you risk changes to > the collection causing the collection to be re-assigned and thus flush > the open items list. > > Thus: > [Bindable[ > var xmlc:XMLListCollection; > <mx:Tree id="foo" dataProvider="{xmlc"} /> > > may end up resetting the dataProvider as you modify xmlc. > > var xmlc:XMLListCollection > <mx:Tree id="foo" initialize="foo.dataProvider=xmlc" /> > > Will not reset as it is not watching the collection for bindable > changes. Similarly, if you assign the dataProvider on the result of the > server fetch, you'll be safer that way too. > > ________________________________ > > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of Baljeet singh > Sent: Wednesday, September 05, 2007 9:19 PM > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: Tree collapses when dataProvider for tree > changes > > > > Hi, > > Actually, i am using XML string, that is coming from server side. > From that XML string, i get the XMLListCollection as dataProvider. > When i click on selected node, either i am editing th information > related to node or creating children. This edited/children information > is stored in database. > So, dataProvider changes(it's required). Tree is > created on the basis of "id" attribute of each XML node . When > dataProvider changes, i again retrieve that node on basis of "id" > attribute. Then i tried to use expandItem() method, selectedItem etc, > providing the retrieved node. But it's not working. > > Thanks & Regards > Baljeet >