Skip to content

GravionLabs/elysion / .agents/skills/ng-ag-grid-developer

ng-ag-grid-developer

Verified

Build or modify Angular components with AG Grid Enterprise. Use when a task mentions ag-grid.

references/grouping-pivoting.md

View on GitHub
# AG Grid — Row Grouping & Pivoting (Enterprise)

Modules: `RowGroupingModule` (grouping), `PivotModule` + `RowGroupingModule` (pivot), `RowGroupingPanelModule` (group panel), `ColumnsToolPanelModule` (side bar).

## Grouping

```typescript
columnDefs: ColDef[] = [
  { field: 'country', rowGroup: true, hide: true },   // hide: shown in the group column instead
  { field: 'athlete' },
  { field: 'gold', aggFunc: 'sum' },
];
gridOptions: GridOptions = { groupDisplayType: 'singleColumn', groupDefaultExpanded: 1 };
```

- `aggFunc`: `'sum' | 'min' | 'max' | 'count' | 'avg' | 'first' | 'last'`, or a custom name defined in `gridOptions.aggFuncs: { name: (p: IAggFuncParams) => … }`
- `groupDisplayType`: `'singleColumn'` (default) · `'multipleColumns'` · `'groupRows'` · `'custom'` (you supply group columns)
- `autoGroupColumnDef: { headerName, minWidth, cellRendererParams: { suppressCount, checkbox } }` customizes the generated group column
- `groupDefaultExpanded: -1` expands all levels; `rowGroupPanelShow: 'always' | 'onlyWhenGrouping' | 'never'` shows the drag-to-group panel
- Programmatic: `api.expandAll()`, `api.collapseAll()`, `api.getRowNode(id)?.setExpanded(true)`

## Pivoting

Needs all of: `pivotMode: true`, ≥1 column `rowGroup: true`, ≥1 column with `aggFunc`, ≥1 column `pivot: true`. **Every value column needs an `aggFunc`** — pivot mode only shows aggregated rows.

```typescript
columnDefs: ColDef[] = [
  { field: 'country', rowGroup: true, hide: true },
  { field: 'sport', pivot: true, enablePivot: true },  // enablePivot lets users pivot via UI
  { field: 'gold', aggFunc: 'sum' },
];
// template: [pivotMode]="true" [sideBar]="'columns'"
```

- `pivotMode: true` with no `pivot` column strips non-group/value columns and produces no pivot labels
- UI control: `sideBar: 'columns'` (users drag into Row Groups / Values / Labels) or `pivotPanelShow: 'always' | 'onlyWhenPivoting' | 'never'`
- Runtime: `api.setGridOption('pivotMode', true)`, `api.applyColumnState({ state: [{ colId: 'sport', pivot: true }] })`, `api.getPivotResultColumns()`
- With SSRM the server gets `pivotCols`, `pivotMode`, `rowGroupCols`, `valueCols` in `params.request` and must compute the pivot result and its columns
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall