RE: [flexcoders] Re: Tree collapses when dataProvider for tree changes

2007-09-06 Thread Alex Harui
Again, I would recommend not using a binding expression to assign the
XML to the dataProvider.  Otherwise, I can't see why it would get
reassigned unless your code is doing so.
 
A call to validateNow() may be required after assigning the dataprovider
before calling expandItem.  Or use callLater.
 
Showing some code or creating a mini-example may help us see what you
are doing.



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Thursday, September 06, 2007 10:24 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: Tree collapses when dataProvider for tree
changes



A few things to consider.

1)   How are you adding nodes?.  If you use XML as the dataProvider
and use the XML API to add the nodes, the tree will not collapse.

2)   After you programatically change a dataProvider, you need to
use callLater to defer any interaction with the Tree control, to allow
it to render first.

3)   If you use XML as the tree dataProvider, you can use e4x
expressions to find the node by its Id property, rather then iterating
recursively over the collection.

Tracy



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Baljeet singh
Sent: Thursday, September 06, 2007 5:40 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Tree collapses when dataProvider for tree
changes

Hi,

Lets consider an XML as tree of nodes. Let me explain u the meaning of
"id".  My sample XML string look like:





   





  .
.
 



   



 Here my each XML node has unique Id attribute. 

Now suppose I create a tree with this XML & i click on any node. For the
selected node, say node with id="5", i can find out the value of "id"
attribute of selected node & save this in session object. Means now i
have idea about which node i selected.

Now suppose , i create two children for selected node i.e for node with
id="5". So my XML changes somewhat like below:





   





  .   

 < !-- Level 5th--->

.
 



   



 So my dataProvider changes & tree gets collapsed.

 As we have already stored the id attribte value of selected node in
session. Now we can iterate over XMLListCollection to find the XML  node
with that  particular id value.

& Now  i use expandItem() method  & selectedItem property, providing
selected node. But  none of these things works.

Thanks & Regards,

Baljeet

  

 


RE: [flexcoders] Re: Tree collapses when dataProvider for tree changes

2007-09-06 Thread Tracy Spratt
A few things to consider.

 

1)   How are you adding nodes?.  If you use XML as the dataProvider
and use the XML API to add the nodes, the tree will not collapse.

2)   After you programatically change a dataProvider, you need to
use callLater to defer any interaction with the Tree control, to allow
it to render first.

3)   If you use XML as the tree dataProvider, you can use e4x
expressions to find the node by its Id property, rather then iterating
recursively over the collection.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Baljeet singh
Sent: Thursday, September 06, 2007 5:40 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Tree collapses when dataProvider for tree
changes

 

Hi,

Lets consider an XML as tree of nodes. Let me explain u the meaning of
"id".  My sample XML string look like:





   





  .
.
 



   



 Here my each XML node has unique Id attribute. 

Now suppose I create a tree with this XML & i click on any node. For the
selected node, say node with id="5", i can find out the value of "id"
attribute of selected node & save this in session object. Means now i
have idea about which node i selected.

Now suppose , i create two children for selected node i.e for node with
id="5". So my XML changes somewhat like below:





   





  .   

 < !-- Level 5th--->

.
 



   



 So my dataProvider changes & tree gets collapsed.

 As we have already stored the id attribte value of selected node in
session. Now we can iterate over XMLListCollection to find the XML  node
with that  particular id value.

& Now  i use expandItem() method  & selectedItem property, providing
selected node. But  none of these things works.

Thanks & Regards,

Baljeet

  

 

 



RE: [flexcoders] Re: Tree collapses when dataProvider for tree changes

2007-09-05 Thread Alex Harui
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 
, "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;
> 
>
> may end up resetting the dataProvider as you modify xmlc.
>
> var xmlc:XMLListCollection
> 
>
> 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@yahoogroups.com 
]
On
> Behalf Of Baljeet singh
> Sent: Wednesday, September 05, 2007 9:19 PM
> To: flexcoders@yahoogroups.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
>



 


RE: [flexcoders] Re: Tree collapses when dataProvider for tree changes

2007-09-05 Thread Alex Harui
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;

 
may end up resetting the dataProvider as you modify xmlc.
 
var xmlc:XMLListCollection

 
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:[EMAIL PROTECTED] On
Behalf Of Baljeet singh
Sent: Wednesday, September 05, 2007 9:19 PM
To: flexcoders@yahoogroups.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