Posted by: Sameer on: February 13, 2008
This example shows how AdvancedDataGrid can be configured to show summary with the Group node.
Here, I’m using GroupingCollection to calculate the Summary with summaryPlacement being “group”. Then using groupLabelFunction in AdvancedDataGrid and returning the Group Node’s value plus the Summary value.
Source mxml is located here.
Hi sameer….
How can u make ur “From” column sort i.e it should sort group also along with flat data.
For quite a while Iam looking for the solution…
Thanks in advance
Hey sameer,
Thanks man it worked my label property was not setting properly.
Now iam able to set it properly and sort it.
Thank you for posting the way of configuring it. It is really helpful!
Hey sameer,
iam using XMLListCollection(searchResultXMLColl) as my FlatDataProvider
here goes the code…
var sumRow:SummaryRow= new SummaryRow();
var sumField1:SummaryField= new SummaryField(‘SPEND_PRE’,'SUM’);
var sumField2:SummaryField= new SummaryField(‘SPEND_CUR’,'SUM’);
gf = new GroupingField();
grp = new Grouping();
gc= new GroupingCollection2();
gc.source = searchResultXMLColl;
sumRow.summaryPlacement=’group’;
sumRow.fields=[sumField1,sumField2];
gf.numeric=true;
gf.name=’DBDUNS_NUM’;
gf.summaries=[sumRow];
grp.fields=[gf];
gc.grouping=grp;
gc.refresh();
adg1.dataProvider=gc
But one problem is like iam not able to calculate Summary?
At the Summary Row it is showing 0
earlier when I was using ArrayCollection as a source It was giving me accurate total.
I am also using Itemrenderer(LinkButton) on my first column of dataGrid.The link button was coming fine and also the summary when the groupingCollection’s source was ArrayCollection
But now iam not getting any summary except 0 and Itemrenderer is ignored and a simple text been diplayed at the first column.
Good work Sameer.. , was very much handy in time..
Thanks,
Shankar.
How to set the background color for root node
Great example of the operation=”COUNT” function. There are almost no examples in the Flex documentation.
Thank you!
Jonathan
If it is with the HierarchicalData how can we reach this approch?
below is the example of my code..
.myCPStyle {
background-color:#D6C097, #E7D2A7;
openIcon: Embed(source=”upArrow.png”);
closedIcon: Embed(source=”downArrow.png”);
}
August 3, 2008 at 10:09 pm
sameer,
i am trying to build a report using ADG and i have a scenario where i have to show another columns value on the summary.
example
id name age dept
1 x 30 Sales
2 y 20 Sales
3 z 25 Sales
4 x1 30 HR
5 y1 20 HR
6 z1 25 HR
i have to group the data by dept and i have to show the min age, that is fine…. but just next to min age how can i show the persons name who has the minimum age.