# treeNodeToggled

Emitted when tree expansion changes. Inspect the path and expanded state.

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

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

## What does this API do?

Emitted when tree expansion changes. Inspect the path and expanded state.

API for Pro features: Tree data

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

## Exact input and result types

```typescript
treeNodeToggled: { path: readonly string[]; expanded: boolean }
```

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

## Usage flow

Subscribe with grid.addEventListener('treeNodeToggled', 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('treeNodeToggled', event => {
  console.log(event.detail);
}, { signal: controller.signal });
// On view disposal: controller.abort();
```

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

## Feature explanations and examples

- [Tree data](https://grid.syidax.com/docs/features/tree-data.md) — Trees display parent-child data, such as folders or organizations, with indentation and expansion controls. Unlike grouping equal values, the parent relationship already exists in the data.
