Extracting the source from an IHierarchicalCollectionView

When you set Object/Collection as a source for an AdvancedDataGrid to display the source in a Hierarchical manner, the AdvancedDataGrid.dataProvider will return an instance of IHierarchicalCollectionView because internally the source is used to construct a HierarchicalCollectionView which is returned via the dataProvider property.

What if, you want the original source from this IHierarchicalCollectionView. Well, there are some API’s for achieving this –

// First, get the HierarchicalData used to create the HierarchicalCollection
var hd:IHierarchicalData = IHierarchicalCollectionView(adg.dataProvider).source;

//From the HierarchicalData, get the source collection/object
var source:Object = hd.getRoot();

Here is a sample.
Source here.

Showing Summary with the Group Node

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.

Accessing Grouping.label in Summary Rows in AdvancedDataGrid

The GroupLabel specified while creating a GroupingCollection can be accessed while displaying summaries in AdvancedDataGrid.

Although, accessing the GroupLabel in summary rows can be quite a tedious task but it can be very useful.

Here is a sample. In this sample, the Group name is displayed in the summary rows along with the value for the summary.