For some xml:

 

<node label="top">

            <node label="middle">

                        <node label="leaf1" />

                        <node label="leaf2" />

            </node>

</node>

 

You are essentially passing into the dataProvider property one node
(top), and internally, the Tree opens a collection with length 1.  As
you call expandItems or change openNodes directly, the Tree's internal
collection gets more nodes.  If I call expandItem on 'top', the internal
collection has length 2, and openNodes contains just 'top', and you can
see both 'top' and 'middle' in the tree.  If you then call expandItem on
'middle', the collection has length 4, openNodes contains both 'top' and
'middle', and you can see all four nodes in the Tree.  Setting
selectedIndex to 0 will select 'top', setting selectedIndex to 3 selects
'leaf2'.

 

For some complex tree if you have to scan, having the correct set of
openNodes by calling expandItem in the right sequence will let you walk
the internal collection to determine the index of the node you want.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of j_lentzz
Sent: Monday, February 11, 2008 5:29 PM
To: [email protected]
Subject: [flexcoders] Re: How to programatically select a node in an
XMLListCollection

 

What is the difference between using openItems and collection? 
openItems seems to be like the collection.openNodes - only expanded. 
Also, how do you move through openNodes? It seems like XML structures
still. 
Thanks,

John
--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> openNodes doesn't work very well in Flex 2.
> 
> 
> 
> You'll probably have to call expandItem in order from the top down so
> each parent the nodes you want to see is opened before the child nodes
> are opened.
> 
> 
> 
> You can't use the .dataProvider property. You have to subclass and use
> the collection property
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of j_lentzz
> Sent: Monday, February 11, 2008 1:35 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: How to programatically select a node in an
> XMLListCollection
> 
> 
> 
> I'm using Flex 2 (if that matters any). So I need to expand all of
> the tree (or just to the nodes I want to select), then walk the
> dataProvider to find the nodes?
> 
> John
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> , "Alex Harui" <aharui@> wrote:
> >
> > In Flex 3, you can call expandItem or set openNodes to get all the
> nodes
> > to open, then I would subclass Tree and use the walk the collection
> > which should then contain the nodes you want and find the index of
> those
> > items and set selectedIndex appropriately.
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of j_lentzz
> > Sent: Monday, February 11, 2008 12:28 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] Re: How to programatically select a node in an
> > XMLListCollection
> > 
> > 
> > 
> > I took a look at that post, but it doesn't address what I need to
do.
> > I can find the node using the XML navigation methods, however, I
want
> > to create a list of total nodes matched (there can be many) then
allow
> > the user to jump from match to match, so I need to be able to select
a
> > node and highlight it. Any thoughts?
> > 
> > Thanks,
> > 
> > John
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > , "Brad Bueche" <brad@> wrote:
> > >
> > >
> >
>
http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-in
<http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-i
n> 
>
<http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-i
<http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-i
> 
> n> 
> >
>
<http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-i
<http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-i
> 
>
<http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-i
<http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-i
> 
> > 
> > n> 
> > >
> >
>
-Flex-20-Using-The-For-Each-Statement-And-The-Descendent-Accessor--Opera
> > > tor
> > > 
> > > That should give you most of what you need to know.
> > > 
> > > brad
> > > 
> > > -----Original Message-----
> > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > ] On
> > > Behalf Of j_lentzz
> > > Sent: Monday, February 11, 2008 12:43 PM
> > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com> 
> > > Subject: [flexcoders] How to programatically select a node in an
> > > XMLListCollection
> > > 
> > > 
> > > 
> > > Hi,
> > > 
> > > I have a Tree with the dataProvider being an XMLListCollection.
When
> > > looking at the dataProvider with the debugger, all I see is a
single
> > > XMLList that contains the complete XML structure - that is all the
> > > nodes and sub-nodes all in one element. I have a routine that will
> > > traverse the tree and find nodes based on parameters I set - and
it
> > > will open those nodes. However, I want to be able to jump from
found
> > > item to found item, but I can't find a way to set the index to
> > > highlight the item. Is there a way to do this that someone could
> > > explain?
> > > 
> > > Thanks,
> > > 
> > > John
> > >
> >
>

 

Reply via email to