The Flex 2 Tree control was designed with this scenario in mind.  I'd
take a look at the ITreeDataDescriptor, its default impl, and the
various examples on this list and in the FDS samples.war. 

Basically, you'll pass your data to the Tree as it is. Then you'll
implement your own ITreeDataDescriptor.getChildren method to fetch the
remote children for a node.  The isBranch and hasChildren methods can
key off of your childrenCount attribute, which also happens to be a
good optimization. 

Finally, if you need to, you'll probably be able to optimize further
by caching fetched results and possibly prefetching layers ahead of
time.  The FDS managed objects might also help in this regard. 

Also note, this is just one approach, I'm sure there are others. 

Hope that helps,

-Michael



--- In flexcoders@yahoogroups.com, "Torben Nielsen" <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>

>
> I am currently wrestling with a project htat makes use of the tree
> component. I donĀ“t really know how to approach this project and I
would like
> some help from you.
>

>
> My client has a data source that is a little special. I first call
it and
> get the root elements for the tree with a result like this:
>

>
> <?xml version="1.0" encoding="utf-8" ?>
>

>
<http://farm.sitemanager.it/sitemanager/modules/treedb.asp?id=0&csite=spi##>
> - <resource xmlns:sql="urn:schemas-microsoft-com:xml-sql" label="/"
id="0"
> name="ROOT">
>
>   <r id="1" label="Previdenza" childrenCount="3" />
>
>   <r id="13" label="Welfare" childrenCount="3" />
>
>   <r id="3" label="Economia" childrenCount="3" />
>
>   <r id="15" label="Donna" childrenCount="3" />
>
>   <r id="16" label="Cultura" childrenCount="3" />
>
>   <r id="17" label="Internazionale" childrenCount="3" />
>
>   <r id="2" label="Organizzazione" childrenCount="3" />
>
>   <r id="14" label="Servizi" childrenCount="3" />
>
>   <r id="4" label="" childrenCount="15" />
>
>   <r id="1334" label="Congresso" childrenCount="3" />
>
>   </resource>
>

>
> Each element has a childernCount attribute which defines how many
subnodes
> are connected to that node.
>
> The next step in the application is to retrieve the sub nodes for each
> parent node and combine them into the complete data source for my tree
> component.
>
> This is an example of the data for the sub nodes:
>

>
> <?xml version="1.0" encoding="utf-8" ?>
>

>
<http://farm.sitemanager.it/sitemanager/modules/treedb.asp?id=1&csite=spi##>
> - <resource xmlns:sql="urn:schemas-microsoft-com:xml-sql">
>
>   <r id="168" label="News" childrenCount="27" />
>
>   <r id="205" label="Indice" childrenCount="23" />
>
>   <r id="81" label="Documenti" childrenCount="3" />
>
>   </resource>
>

>
> Initial it's only the first two levels that will be retrieved. The
rest must
> be loaded according to the actions of the user.
>
> I am sure that some of you may think "why not create a script that
creates
> the entire XML document at once", but my client won't do this, so I
have to
> make due with this system.
>

>
> Any ideas/suggestions/helpful info that can get me on the road will be
> extremely helpful for me.
>

>
> Thanks.
>

>
> Best regards.
>

>
> Torben Nielsen
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to