Thursday, June 14, 2007
AdvancedDataGrid Summary roll up sample
Here is a sample application showing Summary roll up feature in AdvancedDataGrid and GroupingCollection. The GroupingCollection takes flat data in the form of a ICollectionView object as input and generates a grouped collection based on the GroupingField information provided. The example shows grouping on the Region and Territory data fields. Of-course don't forget to call the refresh method on the GroupingCollection to make the collection to generate the grouping. If Summary is desired Summaries with SummaryRow and SummaryField information can be added to each GroupingField object. The SummaryRow has a summaryPlacement property which can take multiple values as input from the possible values of group, first and last. I have used group to show the roll up of summary values. SummaryField has a operation property which by default supports "SUM", "MIN", "MAX", "AVG" and "COUNT". ADGColumn has support for a formatter which can be used to format cell values using any Flex formatter. I have used currency formatter to place a $ symbol. ADG and ADGColumn have a style function property which can be used to set style values on a particular cell based on its data content. The example uses this to change the font color to red. Oh! ADG has loads of features. Check it out. Before I forget here is MXML file for the sample.