While I can’t help with specifics, this kind of thing is done fairly often.

 

In most cases, the data services are performant enough to support dynamic tree building, and the tree definitely supports it as well.

 

When a user selects a node whose children.length < childrencount , make the data service call using whatever logic is necessary to get the child xml.

 

In a result handler function, use e4x methods to add the child nodes to the parent node.  Use the AsyncToken to hold a reference to the parent node so it will be readily available in the result handler.

 

Actually this sounds pretty straightforward.  Like I say, I haven’t done it though.

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of Torben Nielsen
Sent: Tuesday, May 30, 2006 5:53 PM
To: [email protected]
Subject: [flexcoders] Flex 2 B3 :: Tree component doubts

 

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" ?>

- <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" ?>

- <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