--- In flexcoders@yahoogroups.com, muruga <murugave...@...> wrote:
>
> 
> Hi
> 
> I have advanceddatagrid in which i am displaying the data in Tree 
structure.
> Since the data is huge and it is taking lots of time to retrieve 
from
> databse, we wanted build the tree dynamically. Means initially we 
want to
> display the tree only will the parent nodes. Only when the user 
expands the
> parent node, we need to build the children node of this parent node 
(only
> when the user expands the parent node, we go to DB and retrieve the 
children
> node details). Is it possible to do this with FLEX advanceddatagrid 
tree
> structure. First i would like to know, is it feasible to do? if 
yes, then
> how to do it. It is very urgent.

I've done this, not with an AdvancedDatagrid, but with a 
HierarchicalCollectionView, which is what an ADG dataProvider is.  
Essentially, I called a service that gave me the top level of the 
hierarchy.  The objects that populate the HierarchicalCollectionView 
each have a method that loads the children.  

I don't wait for the user to open the nodes.  Instead, I start 
loading the children in the background by calling this method as soon 
as the top level is known.  The child object will generate an event 
when its children are loaded, and then the parent class (which has 
the HierarchichalCollectionView as a property) will call the next 
child in the line.

If a user selects a child that has not loaded its children yet, when 
the event fires that says the last child was loaded, I interrupt the 
predictive load to load that one.  This has been discussed recently 
on here, and I think the person who was doing this type of load on a 
Tree control had to do something once the load was complete to tell 
the node to open.

HTH;

Amy

Reply via email to