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.

Source

Advertisements

13 thoughts on “Accessing Grouping.label in Summary Rows in AdvancedDataGrid

  1. Hey Sameer,
    I’m using the groupLabelFunction to set the name of the groups in my chart. Is there a way to be able to extend the width of the group label name? For example if I want my group name to span more than one column can I do that or is my label limited to the width of the first column its in?

  2. Hi,
    I was wondering, is there a way to make summaries recalculate after you edit the data in the group? (this is when you present a summary but the, but the column is editable so you change the value, but the summary wont, therefore being incorrect after the edit)

  3. So, the summaries will be updated automatically if the data changes. But you have to make sure that the data rows are Bindable. If you are using Objects then changing the data values will not result in summary updation because Objects does not dispatch any event for property value changes. Using ObjectProxy instead of Obect can re-solve this.

    You can also use ICollectionView.itemUpdated() whenever any property changes.

  4. Sammer, thank you for your POST.

    How can I filter the exhibition for the summary rows using filterfunction or similar when the total value is between the slider range?

    Thank you again

    Roberto

    • One approach will be to provide a summary object with a property, for example – {summary:true}. Now, in your filter function you will know the summary rows by checking the summary property. Check for the conditions and filter out the summary rows now.

      • Sameer,

        Thank you very much for your answer. My dataProvider is an ArrayCollection. How I create an Object to control summary if I don’t have a hierarchy? I’m sorry if my question is elementary but I’m novice….

        If you want to access the screenshot and the code from application, it’s here:

        http://www.arts-sol.com.br/treina.zip

        I tried to use a HierarchicalViewCollection.Filterfunction and almost work, my can not identify only summary rows. The filter is applying in all rows.

        Thank you again

        Roberto

  5. Hi Roberto,
    I see that summaryPlacement is group in your case. So, I think you want to avoid group nodes from getting filtered out.
    For this you can provide a GroupingField.groupingObjectFunction –
    <mx:GroupingField name=”nome” groupingFunction=”agrupaNome” groupingObjectFunction=”groupObjFunc”>
    <mx:summaries>
    <mx:SummaryRow summaryPlacement=”group”>
    <mx:fields>
    <mx:SummaryField dataField=”horas” operation=”SUM” id=”teste” />
    </mx:fields>
    </mx:SummaryRow>
    </mx:summaries>
    </mx:GroupingField>

    // the grouping object function
    private function groupObjFunc(label:String):Object
    {
    return {grouped:true};
    }

    Now, you can check for item.grouped property in the filter function.

    If the summaryPlacement is not group, then there will be a new row created for placing the summary row. So, you can use SummaryRow.summaryObjectFunction in a similar manner shown above (just make sure you create an instance of SummaryObject instead of Object). Or you can check for an instance of SummaryObject class in the filter function.

  6. Hello Sameer,

    Your examples were great.But I have a big doubt .

    Actually I have an advanced data grid(ADG), with the first column, being a checkbox and the next column is a tree, followed by set of data grid.I have implemented a custom checkbox component and added it as the first column of the ADG and a xml as a dataprovider for the rest of the columns.Now I need to group the tree column and the last column and a summary group .If I include the grouping tags , an error is showing up saying there is no implementation of the checkbox in the data provider. Could you please let me know how to resolve this issue.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s