To configure group summaries, populate the summary.groupItems array with summary configuration objects. Each object should specify a column that supplies data for summary calculation and a summaryType—an aggregate function that should be applied to this data.
Group summaries are displayed in parentheses after the group caption. You can reposition them as follows:
Display a summary in a column
You can align a summary to its corresponding column (see the Sale Amount and Total Amount columns). To do this, enable the alignByColumn property. If you want to align a summary to a different column, specify the showInColumn property.
Display Summary Values within Group Footers
You can make a summary item display its values within group footers. To do this, enable the showInGroupFooter property. Summary items will appear within their corresponding columns (see the Total Amount column). If you want to display summaries in another column, specify the showInColumn property.
To format summary values, use the valueFormat property. This demo applies the "currency" format to summary values calculated against the Total Amount and Sale Amount columns. If you also want to add custom text to summary values, use the displayFormat property. This demo sets this property for summaries of "sum" and "count" types.
This demo sorts groups by summary values (the number of orders). To do this, the code adds an object to the sortByGroupSummaryInfo array. The object specifies the summaryItem whose values are used to sort the group rows.