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

> The TreeLayout interface of @salmonui/data-grid/engine/tree: Pre-order layout of the kept rows of a tree. Arrays named by slot are indexed by pre-order slot, the others by source index.

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

```ts
import type { TreeLayout } 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: interface

```ts
interface TreeLayout {
    readonly sourceCount: number;
    readonly count: number;
    readonly order: Int32Array;
    readonly slot: Int32Array;
    readonly next: Int32Array;
    readonly parent: Int32Array;
    readonly depth: Uint16Array;
    readonly childCount: Int32Array;
    readonly posinset: Int32Array;
    readonly setsize: Int32Array;
    readonly roots: Int32Array;
}
```

Pre-order layout of the kept rows of a tree. Arrays named `by slot` are indexed by pre-order slot, the others by source index.

Members (11):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `sourceCount` | `readonly sourceCount: number;` |  | Source rows the layout was built over. |
| `count` | `readonly count: number;` |  | Kept rows (slots). |
| `order` | `readonly order: Int32Array;` |  | By slot: source index. |
| `slot` | `readonly slot: Int32Array;` |  | Source index -> slot, or -1 when the row is not kept. |
| `next` | `readonly next: Int32Array;` |  | By slot: first slot after the subtree. |
| `parent` | `readonly parent: Int32Array;` |  | Effective parent (nearest kept ancestor) source index, or -1 for a root. |
| `depth` | `readonly depth: Uint16Array;` |  |  |
| `childCount` | `readonly childCount: Int32Array;` |  | Kept children. |
| `posinset` | `readonly posinset: Int32Array;` |  | 1-based ordinal among kept siblings (`aria-posinset`; 0: not kept). Built on first read. |
| `setsize` | `readonly setsize: Int32Array;` |  | Kept siblings including the row (`aria-setsize`; 0: not kept). Built on first read. |
| `roots` | `readonly roots: Int32Array;` |  | Slots of the root rows, ascending. |
