Pivot Table Plugin for tbw-grid
Transforms flat data into a pivot table view with grouped rows, grouped columns,
and aggregated values. Includes an interactive tool panel for configuring
row groups, column groups, and value aggregations at runtime.
import { PivotPlugin } from ' @toolbox-web/grid/plugins/pivot ' ;
Option Type Default Description activebooleantrueWhether pivot is active on load rowGroupFieldsstring[][]Fields for row grouping columnGroupFieldsstring[][]Fields for column grouping valueFieldsValueField[][]Aggregation value fields showTotalsbooleantrueShow row subtotals showGrandTotalbooleantrueShow grand total row showToolPanelbooleantrueShow interactive pivot panel defaultExpandedbooleantrueGroups expanded by default indentWidthnumber20Indent per depth level (px) animationfalse | 'slide' | 'fade''slide'Expand/collapse animation
sum, avg, count, min, max, first, last
Method Signature Description expandGroup(path: string[]) => voidExpand a specific group collapseGroup(path: string[]) => voidCollapse a specific group expandAll() => voidExpand all groups collapseAll() => voidCollapse all groups
Property Default Description --tbw-pivot-group-bgvar(--tbw-color-row-alt)Group row background --tbw-pivot-grand-total-bgvar(--tbw-color-header-bg)Grand total row
import ' @toolbox-web/grid ' ;
import { PivotPlugin } from ' @toolbox-web/grid/plugins/pivot ' ;
rowGroupFields: [ ' region ' , ' product ' ],
columnGroupFields: [ ' quarter ' ],
valueFields: [{ field: ' sales ' , aggFunc: ' sum ' , header: ' Total ' }],
rowGroupFields: [ ' category ' ],
valueFields: [{ field: ' amount ' , aggFunc: ' sum ' }],
Extends BaseGridPlugin
Inherited methods like attach(), detach(), afterRender(), etc. are documented in the base class.
Property Type Description PANEL_IDpivotTool panel ID for shell integration
toggle (key: string): void
Name Type Description keystring
expand (key: string): void
Name Type Description keystring
collapse (key: string): void
Name Type Description keystring
isExpanded (key: string): boolean
Name Type Description keystring
getPivotResult (): PivotResult | null
setRowGroupFields (fields: string[]): void
Name Type Description fieldsstring[]
setColumnGroupFields (fields: string[]): void
Name Type Description fieldsstring[]
setValueFields (fields: PivotValueField[]): void
Show the pivot tool panel.
Opens the tool panel and ensures this section is expanded.
Hide the tool panel.
Toggle the pivot tool panel section.
Check if the pivot panel section is currently expanded.
isPanelVisible (): boolean
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt