Server-Side Row Model - Pivoting

View as Markdown

Summary

  • Pivoting is available in AdapTable when using the Server-Side Row Model
  • The data needs to be pivoted on the server and passed to the client to display
  • Pivot result columns are created dynamically from the server response

Find Out More

Client-side pivot state and ColDefs — Defining Pivot Layouts and Pivot Layouts. This guide covers server-side data and columns only.

AdapTable fully supports Pivoting when using the Server Side Row Model.

Nothing additional needs to be added, on the AdapTable side, to that which is provided in AG Grid's Server-Side architecture.

Note

After each getRows response you typically build AG Grid pivot result columns from the fields the server returns (see pivotResultColumns.ts in the demo).

Column Order

Each time the datasource supplies the Pivot Result Columns to AG Grid, they are displayed in the supplied order.

That order also replaces the one saved in the PivotResultColumnsOrder property of the Layout, so an order set by the user, or provided in Initial State, is not restored when the grid loads.

Note

To display the Pivot Result Columns in a particular order, supply them to AG Grid in that order

SSRM - Pivoting
Fork
  • Uses the public athletes mock server (data.adaptable.dev) to pivot on the server and return rows + pivotFields
  • Switch Layouts in the Dashboard toolbar to compare patterns:
    • Year Pivot — group by Country, pivot on Year, sum Gold (dynamic year columns)
    • Multi-Value Pivot — same pivot with Gold / Silver / Bronze under each year group
    • Multi-Group Pivot — group by Country then Sport, pivot on Year (expand a country to drill down)
    • Agg-Only Pivot — Pivot Sum style: group by Country, sum medals, no PivotColumns (empty array)
  • Pivot result columns are rebuilt whenever the server returns a new pivotFields set
Loading demo…