GRID FEATURE · PRO

Pivot analysis

Pivoting divides source orders into row, column, and value axes to create a cross-tabulation. Unlike collapsible row groups, unique values such as statuses become new result columns.

How it works and when to use it

For example, teams form rows, regions form columns, and quantities are summed. Prepare all three axes before enabling pivotMode and choose aggregation for each numeric field.

Using this feature in a product requires the Pro package and a valid license. Matching setting names do not enable Pro features in Community.

In the code, grid is the Grid element prepared in the installation chapter. Check each example's data and settings, and implement the app functions and server endpoints for your project.

Example 1. Quantity by team × region

Apply to a table whose source data contains team, region, and quantity.

javascript
grid.pivotRowGroupColumns = ['team'];
grid.pivotColumns = ['region'];
grid.pivotValueColumns = ['quantity'];
grid.pivotAggFuncs = { quantity: 'sum' };
grid.pivotMode = true;

Verify the result: A result column appears for each region, containing each team's quantity total. Source order rows are not modified.

Example 2. Position subtotals and grand totals

With multiple row-axis levels, choose where intermediate and overall totals appear.

javascript
grid.pivotRowGroupColumns = ['region', 'team'];
grid.pivotSubtotals = 'bottom';
grid.pivotGrandTotal = 'top';
grid.pivotPanelShow = 'always';

Verify the result: Read subtotals below expanded child groups and see the grand total at the top.

Example 3. Inspect generated result columns

Before connecting charts or export, read the actual result-column identifiers and current combination state.

javascript
console.log(await grid.getPivotSecondaryColumns());
console.log(await grid.getPivotCombinationReport());

Verify the result: Use returned identifiers instead of region labels as column IDs. Server pivoting uses getServerPivotResultColumns() and a separate server-response contract.

Combining features and troubleshooting

Do not guess precedence among row grouping, trees, and pivoting. Check active features and restrictions in the combination report first.

Do not assume source filters affect pivot aggregation identically. Verify the current aggregation scope and results, and prepare pivot input data first if needed.

Related reading