# rowGroupToggled

Emitted when a row group expands or collapses. Reuse the actual key in detail, not the display label.

Canonical: https://grid.syidax.com/docs/events/rowGroupToggled/

<a id="meaning"></a>

## What does this API do?

Emitted when a row group expands or collapses. Reuse the actual key in detail, not the display label.

API for Pro features: Row grouping, built-in aggregation and group totals

<a id="contract"></a>

## Exact input and result types

```typescript
rowGroupToggled: { key: string | null; expanded: boolean }
```

<a id="usage"></a>

## Usage flow

Subscribe with grid.addEventListener('rowGroupToggled', handler). The result is in event.detail, and event names are case-sensitive. Remove subscriptions when disposing of the view.

```javascript
const controller = new AbortController();
grid.addEventListener('rowGroupToggled', event => {
  console.log(event.detail);
}, { signal: controller.signal });
// On view disposal: controller.abort();
```

<a id="recipes"></a>

## Feature explanations and examples

- [Grouping and aggregation](https://grid.syidax.com/docs/features/row-grouping.md) — Row grouping collects source rows with the same region or team into expandable groups. Unlike column groups, which organize headers, row groups change displayed rows and aggregation results.
