[flexcoders] Re: Footer row with a DataGrid

2008-12-04 Thread simonjpalmer
I also looked at Alex's code and decided I wanted something a little
more suited to my peculiar needs.  I implemented a custom control
which has two data grids, one for the data and one for the totals at
the bottom.  I also added some fancy code to cope with making totals
in different ways (e.g. aggregating averages - the old sum(x)/n vs
sum(x/n) problem) and to handle formatting.

It is not as clean an interface as I would like, but it is pretty
useful and it now appears in lots of places in my UI.  There is a
known bug where the column widths are misaligned when trhe control
first shows, but my users seems to be able to live with that.

If you contact me at simon.palmer @ gmail.com I'll send you some code
and you can perhaps adopt it for your own needs.  If I could figure
out a host who would allow swf's I'd post it on my blog.

--- In flexcoders@yahoogroups.com, Guy Morton [EMAIL PROTECTED] wrote:

 Hi people
 
 What is the best way to achieve a footer row in a DataGrid?
 
 I want to be able to set the values in the footer row myself, ie I  
 don't need it to do any fancy calculations.
 
 I found this:
 
 http://blogs.adobe.com/aharui/2008/03/flex_3_datagrid_footers.html
 
 Does anyone have a better idea as to how to proceed?
 
 TIA
 
 Guy





[flexcoders] Re: Footer row with a DataGrid

2008-12-04 Thread Marielle Lange
--- In flexcoders@yahoogroups.com, Guy Morton [EMAIL PROTECTED] wrote:
 Does anyone here have a different solution that they would recommend  
 for some reason?
 
 Given that no-one has suggested an alternative, I think the answer 
to  
 that might be No.


It is possible of having a datagrid for the footer information under 
the one of the data table. 

It's simpler to handle but the behavior is not as smooth as in Alex's 
demo. The columns of the footer DG get aligned only after you have 
dropped the column bar into its new position. 


mx:Script
![CDATA[
private function onColumnStretch(event:DataGridEvent):void
{

DataGridColumn(summaryDG.columns[event.columnIndex]).width = 
DataGridColumn(dataDG.columns[event.columnIndex]).width;
}

// You may also need to run this on container resize
public function alignColumns():void
{
for(var i:uint = 0; i  dataDG.columns.length; i++)
{
DataGridColumn(summaryDG.columns[i]).width = 
ataGridColumn(dataDG.columns[i]).width;
}
}
]]
/mx:Script


mx:DataGrid
id=dataDG 
columnStretch=onColumnStretch(event)
width=100% height=100%
verticalScrollPolicy=on
columns={dgColumns}
dataProvider={dgProvider}
/

mx:DataGrid
id=summaryDG
showHeaders=false
width=100% height=25
columns={sumColumns}
dataProvider={sumProvider}
/