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/column-definitions.md

View on GitHub
# AG Grid — Column Definitions & Generics

Type everything with the row type: `GridOptions<T>`, `ColDef<T>`, `ColGroupDef<T>` — `field` is then checked against `T`, and `p.data` is `T | undefined`.

```typescript
const columnDefs: (ColDef<Product> | ColGroupDef<Product>)[] = [
  {
    headerName: 'Info',
    children: [{ field: 'name' }, { field: 'category', filter: 'agSetColumnFilter' }],
  }, // Set filter: Enterprise
  { field: 'price', type: 'currency', pinned: 'right' },
];
const defaultColDef: ColDef = { flex: 1, minWidth: 100, filter: true };
```

## Column types (reusable presets)

```typescript
const columnTypes: Record<string, ColTypeDef> = {
  currency: {
    filter: 'agNumberColumnFilter',
    valueFormatter: (p) => (p.value != null ? `€${p.value.toFixed(2)}` : ''),
  },
};
```
Bind with `[columnTypes]` and `type: 'currency'` on the ColDef.

## Value hooks

| Hook             | Purpose                                                                                 |
| ---------------- | --------------------------------------------------------------------------------------- |
| `valueGetter`    | Computed value, not stored in data                                                      |
| `valueFormatter` | Display only                                                                            |
| `valueParser`    | Parse user input to a typed value                                                       |
| `valueSetter`    | Write edit back to data — required when `valueGetter` is used; return `true` if changed |

`cellDataType`: `'text' | 'number' | 'boolean' | 'date' | 'dateString' | 'object'` (inferred automatically; override when needed). `pinned: 'left' | 'right'`.

## Updating columns at runtime

```typescript
api.setGridOption('columnDefs', newColDefs);
api.applyColumnState({ state: [{ colId: 'price', sort: 'desc', hide: false }], applyOrder: true });
```

## Typed events and row identity

```typescript
onGridReady(e: GridReadyEvent<Product>) { this.#api = e.api; }
onCellValueChanged(e: CellValueChangedEvent<Product>) { this.#service.save(e.data); }
getRowId = (p: GetRowIdParams<Product>) => String(p.data.id);
```
`getRowId` is required for `applyTransaction`, SSRM row refresh and selection that survives data updates.

`@ViewChild('grid') grid!: AgGridAngular<Product>` gives a typed `grid.api`.

Custom renderer params: extend `ICellRendererParams<T>` and pass `cellRendererParams: {...} satisfies Partial<MyParams>`.
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