A Grid container creates a row for every child. The DataGrid only
creates a row for every visible child. The difference is significant
for very large data sets. However, because Grid rows can be anything,
it can be easier to customize your appearance.
Various folks have put together Tree/DataGrid combinations. See farata
systems for an excellent example. You might just want to use their
stuff.
If you want to grow your own, other folks have done column span. The
key is that the right column is at the top of the z-order for a row, and
there is no clipping so it can actually draw itself into negative
coordinates obscuring the columns to the left.
Various other folks have built Collection wrappers that fake rows in a
collection so they can insert group data items. Their renderers then
detect that and draw themselves differently.
Below is code from a two-line header where it showed a title on top and
revenue/profit on the second row.
private var revenue:UITextField;
private var profit:UITextField;
private var title:UITextField;
override protected function createChildren():void
{
super.createChildren();
revenue = new UITextField();
revenue.text = "Revenue";
addChild(revenue);
profit = new UITextField();
profit.text = "Profit";
addChild(profit);
title = new UITextField();
addChild(title);
}
override protected function commitProperties():void
{
super.commitProperties();
var c:DataGridColumn = DataGridColumn(data);
title.text = c.headerText;
}
override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth,
unscaledHeight);
revenue.setActualSize(unscaledWidth/2,
unscaledHeight);
revenue.move(0, unscaledHeight - 22);
profit.setActualSize(unscaledWidth/2,
unscaledHeight);
profit.move(unscaledWidth/2, unscaledHeight -
22);
title.move(unscaledWidth/2 - title.textWidth/2,
0);
title.setActualSize(title.textWidth + 4,
title.textHeight + 4);
}
-Alex
________________________________
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of leds usop
Sent: Wednesday, January 31, 2007 10:48 PM
To: [email protected]
Subject: Re: [flexcomponents] Best way to create a datagrid with
collapsible grouped panels
Have you considered using Grid instead as the base
class instead of datagrid?
--- Gareth Edwards <[EMAIL PROTECTED] <mailto:ghedwards%40gmail.com> >
wrote:
---------------------------------
So you've got some ideas on how to go about doing
this?
Cheers
Gareth.
Andrew D. Goodfellow wrote:
Gareth,
I was beginning to look into doing this as well.
Perhaps we should worktogether on it?
-Andy
On 1/31/07, Gareth Edwards <[EMAIL PROTECTED]
<mailto:ghedwards%40gmail.com> >
wrote:
Would like to attempt to extend the datagrid control
to allowfor a
number of things.
If anyone has suggestions or snippets of code on how
to make these
possible, it would be much appreciated.
1) Panel type layout within the datagrid allowing for
grouping and
collapsing of datasets.
2) Extension of the grid header to allow for an
additional customizable
header row.
Both the group headers and grid headers need to span
the width of thegrid.
If no one has done this before, suggestions would be
much appreciated.I
have started attempting to implement these features,
but it seems the
datagrid is some what more complex than other
controls.
Cheers
Gareth.
__________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited <http://music.yahoo.com/unlimited>