Sort a Pivot Report
Sort group labels to make a report easy to scan, or sort by a summary to put the largest values first. Sorting changes order; it does not remove records or change the total.
Try sorting the report
Section titled “Try sorting the report”Sorting and filtering
Order generated row/column members while preserving hierarchy
Choose the sorting example to compare ordering by member label with remote summary ordering. Use source filters when you want to narrow the report instead.
Sort generated column labels
Section titled “Sort generated column labels”import type { PivotConfig } from '@revolist/pivot';
const dimensions: PivotConfig['dimensions'] = [ { prop: 'region', name: 'Region' }, { prop: 'quarter', name: 'Quarter', sortable: true, order: 'asc' }, { prop: 'sales', name: 'Sales' },];Dimension metadata controls the ordering available to generated column members. Native row sorting uses the grid’s grouping behavior. See field metadata for inherited column options.
Sort by total sales
Section titled “Sort by total sales”For programmatic analytical queries, use a configured stable measure ID with bySummary:
await controller.replaceQuery({ sort: [{ selector: 'region', bySummary: 'sales-total', desc: true }],});Here controller is a headless controller whose report defines the measure ID sales-total. This is not a method added to the grid. For a custom interface attached to a grid, use the authoring integration.
Summary sorting scores each hierarchy prefix against the opposite-axis grand total. It does not mean sorting by an arbitrary clicked column tuple. Read summary-sort scope before exposing it through a custom UI.
Server-side sorting
Section titled “Server-side sorting”The request’s sort descriptors go to the backend, which must sort complete groups before pagination. A Boolean capability flag is not an implementation of all summary-sort profiles. See remote requests.
Next steps
Section titled “Next steps”Show the top or bottom groups, filter source records, or configure chart data.