Customizing Pivot Columns
There are a number of ways to customize the generated pivot columns and we'll cover each of them in this page. For a longer walkthrough with live demos, see customizing generated pivot columns.
You can pass a column object (or a function that returns one) in three places. Choose the one that matches the scope you want:
pivotColumnon<InfiniteTable />— every generated pivot columnpivotBy.column— all columns in the group generated for that pivot field- aggregationReducers.pivotColumn — only columns generated for that aggregation
Those objects have the same shape as a normal
column, so you can set header, size, style, defaultSortable, and so on.Global: the pivotColumn prop
pivotColumn is applied to every generated pivot column (leaf values and totals). Use it to override inherited column properties(sortability, width, headers, etc).You can also pass a function when the config should depend on the generated column — for example to make leaf columns sortable but keep totals unsortable:
Per pivot field: pivotBy.column
pivotBy.column applies to all pivot columns in the column group generated for that field. Use it when only one pivot level should be customized — for example, make every canDesign column sortable, without touching the country group.A function receives the generated column, so you can vary the header (or any other property) per pivot value:
Per aggregation: aggregationReducers.pivotColumn
Each
reducer can define a pivotColumn. That config is applied only to columns generated for that aggregation — so you can make salary columns sortable and leave a count aggregation as it is.aggregationReducers.pivotColumn on a reducer can also choose which original column to inherit from, or opt out of inheritance entirely — see below.Inheriting from initial columns#
Pivoting is all about aggregations, so you need to specify the
reducers that will aggregate your data. Each reducer can have a field property that specifies the field that will be used for aggregation.If the table
columns collection already has a column bound to the field used in the aggregation, the column configuration will be inherited by the generated pivot column. Override that with aggregationReducers.pivotColumn.inheritFromColumn — pass another column id to inherit from that column instead, or false to inherit from none. See the aggregationReducers.pivotColumn reference for the full column config you can set on the reducer.#
Pivot columns inherit from original columns bound to the same field
loading demo…