# cascadePlan (@salmonui/data-grid/engine/tree)

> The cascadePlan function of @salmonui/data-grid/engine/tree: Rows a cascade toggle of sourceIndex changes: the row and its kept subtree ([slot, next)), then the ancestors whose state follows. Checking selects every ancestor whose descendants become all selected (bottom-up, stopping at the first that does not); unchecking deselects every selected ancestor. Returns source indexes to select and to deselect.

Canonical: https://salmonui.dev/docs/reference/data-grid/engine-tree/cascadePlan

```ts
import { cascadePlan } from '@salmonui/data-grid/engine/tree';
```

Entry index: https://salmonui.dev/docs/reference/data-grid/engine-tree (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/data-grid/engine-tree.md).

## Reference

Kind: function

```ts
function cascadePlan(layout: TreeLayout, counts: Int32Array, sourceIndex: number, checked: boolean, selected: (sourceIndex: number) => boolean): {
    readonly select: number[];
    readonly deselect: number[];
};
```

Rows a cascade toggle of `sourceIndex` changes: the row and its kept
subtree (`[slot, next)`), then the ancestors whose state follows. Checking
selects every ancestor whose descendants become all selected (bottom-up,
stopping at the first that does not); unchecking deselects every selected
ancestor. Returns source indexes to select and to deselect.
