Word,

now that is what I'm talking about. ;-)

ItemRenderers are your best friend!

In my component development, my components are designed around data
renderers. When you actually start designing frameworks around the idea of
passing data in an object, things get really interesting. An new form of
extension is born.

Peace, Mike

On 3/23/07, Evan Gifford <[EMAIL PROTECTED]> 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:flexcompone
[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?




--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to