Row Summaries

View as Markdown

Summary

  • AdapTable allows users to create Row Summaries in their Layouts (see Table Layouts and Table Layout Wizard)
  • They are pinned rows which can be placed at the top or bottom of the grid
  • Each Row Summary can contain multiple aggregations over column data (filtered or all rows — see Filtered Data)

AdapTable provides Row Summaries which display per-Column Aggregation information.

Note

The Aggregation functions are Aggregation Scalar Functions provided and evaluated by AdapTableQL

Row Summaries can be pinned either at the top or bottom of the Grid.

Row Summaries are stored in a Table Layout enabling users to decide on their usage on a per-Layout basis.

Hint

  • Layouts can, alternatively include Grand Total Rows to display Aggregation summaries
  • Grand Total Rows are less powerful or configurable than Row Summaries (but settable via a single boolean prop)

Caution

Row Summaries are not available in Pivot Layouts (but Grand Total Rows are)

Deep Dive

How Row Summaries Work

Caution

Row Summaries are provided to AG Grid as pinned row data, which AG Grid does not display together with manual row pinning or a pinned Grand Total Row. AdapTable therefore does not display a Layout's Row Summaries (and logs a console warning) when:

  • the Layout's Grand Total Row is pinned (GrandTotalRow is pinnedTop or pinnedBottom); use top or bottom to show both
  • AG Grid manual row pinning is enabled (enableRowPinning in GridOptions)

The Row Summaries section of the Layout Editor shows the same message.

The full list of Aggregation functions available in Row Summaries is:

OperationColumn DataTypeDescription of summarised data
SumNumericTotal of column values in scope
AverageNumericAverage of column values in scope
MedianNumericMiddle value of column values in scope (when ordered)
ModeNumeric, String, DateMost common cell value in scope
DistinctNumeric, String, DateCount of distinct values in scope
MaxNumeric, DateHighest value in scope
MinNumeric, DateLowest value in scope
CountNumeric, String, DateNumber of cells in scope
Weighted AvgNumericWeighted average (requires a defined weighted column)
OnlyNumeric, String, DateValue when every cell in scope matches
Std DeviationNumericStandard deviation of column values in scope
Row Summary
Fork
  • This example contains 2 Row Summaries:
    • Top Row Summary: Github Stars and Github Watchers both have SUM Aggregations, Created At shows MIN
    • Bottom Row Summary: Issue Change shows an Aggregation of AVG and Language has an Aggregation of COUNT
Loading demo…

Formatting

By default Column Formatting is automatically applied to Row Summaries (and also to Group Rows).

Note

The Format Column is only applied to cells in the Row Summary which have an Aggregation set

Where not required, this default behaviour can be changed by setting the ExcludeSummaryRows property to true in the RowScope property when defining the Format Column (summary rows are included when the property is omitted or false).

Hint

This allows you to create a Format Column that is only rendered in a Row Summary

The RowScope object enables 4 types of rows to be excluded from a Format Column:

  • Data Rows
  • Grouped Rows
  • Summary Rows
  • Grand Total Rows

Caution

Make sure to set a Column Scope of All columns to ensure the entire row is formatted

Formatted Row Summary
Fork
  • This example demonstrates formatting Row Summaries
  • We provide a Top Row Summary with aggregations for the Language, Github Stars and Github Watchers columns
  • We have provided 4 Format Columns, each of which has a different behaviour for Row Summaries:
    • Language (showing MODE) has a Fore Color of blue and includes Row Summaries but excludes regular rows
    • Github Stars has red italic font and excludes Row Summaries
    • Github Watchers has a Fore Color of yellow and includes Row Summaries
    • Whole Row Format for Row Summary achieved by excluding regular rows
Loading demo…

Filtered Data

By default Row Summaries show Aggregations for the currently visible (i.e. filtered) data in the Grid.

Hint

If this is not desired behaviour, set IncludeOnlyFilteredRows to false in the Row Summary definition

Filtered Row Summary
Fork
  • This example contains 2 Row Summaries with the same 4 Aggregations (which we have also formatted)
  • The only difference is that the Bottom Row Summary has IncludeOnlyFilteredRows set to false
  • We have set a Column Filter on the Github Stars Column, and also a Grid Filter
  • Accordingly the 2 Row Summaries show different values (e.g. COUNT for Language Column is 15 at the top and 25 at the bottom)
Try It Out
  • Clear the Column Filter on the Github Stars Column and the Grid Filter, and note that now the Row Summaries at the top and bottom match up
Loading demo…

Defining in Layouts

Row Summaries can be defined at design-time using the RowSummaries property of the Layout.

Developer Guide

Providing Row Summaries

// 1. Provide 2 Row Summaries:
// Top: SUM Aggregation for Github Stars and Github Watchers
// Bottom: COUNT & AVG Aggregations for Language and Issue Change
const initialState: InitialState = {
  Layout: {
    CurrentLayout: 'Summary Layout',
    Layouts: [
    {
      Name: 'Summary Layout',
      RowSummaries: [
      {
        Position: 'Top',
        ColumnsMap: {
          github_watchers: 'SUM',
          github_stars: 'SUM',
        },
      },
      {
        Position: 'Bottom',
        ColumnsMap: {
          week_issue_change: 'AVG',
          language: 'COUNT',
        },
        IncludeOnlyFilteredRows: false
      },
    ],
    }],
  },
}
1
Define any Row Summaries

Provide a list of Row Summaries.

2
Set the Position

Specify for each Row Summary its position:

  • Top
  • Bottom
3
Provide Summary Columns Map

The Columns Map specifies which columns in the Row will display an Aggregation, and of which summary type:

Two properties need to be provided for each entry:

  • name of the Column
  • the Summary Aggregation to use
4
Specify whether to evaluate all rows

By default a Row Summary will only include currently filtered rows in its evaluation.

Set IncludeOnlyFilteredRows to false to evaluate all Rows.

Hint

  • Row Summaries can also be created at run-time using the Row Summary step in the Table Layout Wizard
  • This allows users to create Row Summaries, choose the position, and select appropriate Aggregations

FAQ

Can we create Row Summaries at run-time? Yes, via the Table Layout Wizard