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

> The treeCopyRowIds function of @salmonui/data-grid/engine/tree: The copied row ids widened by mode over the kept layout of the current query: ancestors adds every kept ancestor, descendants every kept descendant, both both, none nothing. The result is in tree pre-order without duplicates; ids that are not in the layout keep their relative order after the tree rows. O(n) over the kept rows.

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

```ts
import { treeCopyRowIds } 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 treeCopyRowIds(structure: TreeStructure, rowIds: readonly RowId[], mode: 'ancestors' | 'descendants' | 'both' | 'none'): RowId[];
```

The copied row ids widened by `mode` over the kept layout of the current
query: `ancestors` adds every kept ancestor, `descendants` every kept
descendant, `both` both, `none` nothing. The result is in tree pre-order
without duplicates; ids that are not in the layout keep their relative
order after the tree rows. O(n) over the kept rows.
