Sorting Pivot Layouts
Summary
- Pivot Layouts can use the same sorting as Table Layouts
- Both Aggregation Columns and Pivot Result Columns can be sorted
- Custom sorting can be applied to Aggregation Columns in Pivot Layouts
All Columns in the Pivot Layout can be sorted - and the sorted column persisted to AdapTable State.
Aggregation Columns
It is straightforward to set Sorting for standalone Pivot Aggregation Columns.
This is done using the standard ColumnSorts property in the Layout.
Note
- Sorting a Pivot Aggregation Column will not sort that column when there are Pivot Result Columns
- Instead each Pivot Result Column will need to be sorted individually (see below)
Pivot Sorting: Aggregation Columns
- In this example we set Column Sorting for the 2 Pivot Aggregation Columns -
Github StarsandGithub Watchers - We have not provided any PivotColumns - so there are no dynamic Pivot Result Columns created
Pivot Result Columns
It is also possible to sort Pivot Result Columns and save this configuration in the Layout.
This is also done via the ColumnSorts property, by using the AG Grid generated colId for the Pivot Result Column.
Pivot Sorting: Pivot Result Columns
- In this example we set Column Sorting for 2 Pivot Result Columns in the Layout Definition (both using AG Grid's autogenerated
ColumnId) pivot_language_HTML_github_starsandpivot_language_JavaScript_github_watchersare sorted ascendingly
Custom Sorts
AdapTable allow for bespoke sorting via Custom Sort.
This is also available in Pivot Layouts, but only to Aggregation Columns (i.e. not to Pivot Result Columns).
Pivot Sorting: Custom Sorts
- In this example we provide a, slightly random and pointless, Custom Sort on the
Github StarsColumn - we sort in this order: 138066, 9752, 867801 - This Custom Sort is applied in Column Sort that we apply to that Column