The thing that makes development for Flex so interesting is that there a 
zillion different ways to do the same thing in the framework. The 
TreeGrid in FlexLib is done as an extension of the DataGrid. It 
basically keeps the original data provider in tact, and updates a 
"displayed data provider" based on a tree data descriptor.

Just for comparison purposes:
http://flexlib.googlecode.com/svn/trunk/src/flexlib/controls/TreeGrid.as
http://flexlib.googlecode.com/svn/trunk/examples/TreeGrid/TreeGrid_Sample.swf

.. and in case the list missed my announcement this week, the TreeGrid 
was contributed to FlexLib by Yaniv De Ridder - 
http://blogs.adobe.com/yderidder/

-d

Evan Gifford wrote:
>
> Hey Guys,
>
> I’ve got a full working TreeGrid not based on any previous work which 
> addresses all the issues faced with previous TreeGrids.
>
> Here is a tip: Don’t start with the DataGrid!
>
> Start with the Tree. I started with the DataGrid also and added and 
> removed children from the collection upon clicking the “expand” and 
> “contract” buttons. There are two major issues with doing it this way.
>
> First problem is that you are actually duplicating items in the 
> dataProvider which is not how the dataProvider was meant to be used. I 
> believe that the underlying data structure should be left intact and 
> the view should represent the data, much like a View.
>
> Second problem is the list-to-hierarchy conversion. If you re-parent a 
> node visually, you’ll have to do that in the dataProvider as well. 
> Imagine the difficulty of doing this with the drag-and-drop 
> functionality requirement of my project.
>
> If you look at the 3000+ lines of code for the Tree you find this 
> Hierarchy conversion already. Since both Tree and Datgrid inherit from 
> ListBase, it is possible to graft this Tree code into the DataGrid, 
> but I found a much simpler solution :^)
>
> In essence, I created a treeItemRenderer which does not assume that 
> the only part of the _data object displaying is the label. I put a 
> dataGrid inside this renderer and bound the columns back to the model. 
> I turned the headers off of these “renderer Data Grids” Then above the 
> tree I have a DataGrid which displays only headers. A change to this 
> header is handled by a method which writes the columns back to the 
> model which will then update each individual dataGridRenderer through 
> databinding.
>
> Works like a charm!
>
> I’m transitioning to a new job, new part of the country and getting 
> ready to get married in France in this next month, but I’ll try to get 
> this component out to this group soon.
>
> -Evan
>
> ------------------------------------------------------------------------
>
> *From:* [email protected] 
> [mailto:[EMAIL PROTECTED] *On Behalf Of *Mike Matthys
> *Sent:* Thursday, March 22, 2007 9:35 AM
> *To:* [email protected]
> *Subject:* [flexcomponents] Re: Open-source TreeGrid component available
>
> It looks as something is still wrong with the open and close
> functions. When you open e.g. a root node up to its deepest level and
> you try to close it completely by clicking the root node again, only
> the number of rows below that root node equal to the number of
> children the node hase. From then on the rows get completely mixed up
> showing e.g. a child node of root node 1 below root node 2.
>
> Don't know what the best solution to this could be, but seems as you
> need some kind of recursive close function (closing all children's
> children and so on before closing the clicked node itself).
>
> I tried to build this into the treeGridNodeClosed function in the
> TreeGrid class, but for some reason it won't work.
>
> Does anybody have ideas?
>
>  



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcomponents/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcomponents/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to