# GanttApi (@salmonui/gantt)

> The GanttApi interface of @salmonui/gantt: ref; extends the grid pane's DataGridApi.

Canonical: https://salmonui.dev/docs/reference/gantt/GanttApi

```ts
import type { GanttApi } from '@salmonui/gantt';
```

Entry index: https://salmonui.dev/docs/reference/gantt (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/gantt.md).

## Reference

Kind: interface

```ts
interface GanttApi<Row = Record<string, unknown>> extends Omit<DataGridApi<Row>, 'cancelEdit' | 'getState' | 'restoreState' | 'exportToExcel' | 'exportToCsv' | 'exportToPdf' | 'print' | 'undo' | 'redo' | 'setLoading'> {
    readonly grid: DataGridApi<Row>;
    getTask(id: RowId): Row | undefined;
    getTaskInfo(id: RowId): GanttTaskInfo | undefined;
    getViewRows(): readonly Row[];
    getCriticalTasks(): readonly Row[];
    formatDuration(id: RowId): string;
    formatWork(id: RowId): string;
    addTask(task?: Partial<Row>, options?: {
        readonly position?: 'top' | 'bottom' | 'above' | 'below' | 'child';
        readonly targetId?: RowId;
    }): GanttActionResult;
    updateTask(id: RowId, changes: Partial<Row>): GanttActionResult;
    deleteTasks(ids: RowId | readonly RowId[]): GanttActionResult;
    changeTaskId(id: RowId, newId: RowId): GanttActionResult;
    cancelEdit(): void;
    indent(ids: RowId | readonly RowId[]): GanttActionResult;
    outdent(ids: RowId | readonly RowId[]): GanttActionResult;
    moveTasks(ids: RowId | readonly RowId[], targetId: RowId, position: 'above' | 'below' | 'child'): GanttActionResult;
    addDependency(taskId: RowId, dependency: Dependency | string): GanttActionResult;
    removeDependency(taskId: RowId, predecessorId: RowId): GanttActionResult;
    updateDependencies(taskId: RowId, dependencies: readonly Dependency[] | string): GanttActionResult;
    splitTask(id: RowId, date: GanttDateInput): GanttActionResult;
    mergeSegments(id: RowId, segmentIndexes: readonly number[]): GanttActionResult;
    convertToMilestone(id: RowId): GanttActionResult;
    convertToTask(id: RowId): GanttActionResult;
    setTaskMode(id: RowId, mode: 'auto' | 'manual'): GanttActionResult;
    setProjectDates(start: GanttDateInput, end: GanttDateInput): void;
    expandAll(): void;
    collapseAll(): void;
    expandRows(ids: RowId | readonly RowId[]): void;
    collapseRows(ids: RowId | readonly RowId[]): void;
    zoomIn(): void;
    zoomOut(): void;
    zoomToFit(): void;
    getZoom(): number;
    extendTimeline(side: 'start' | 'end'): void;
    scrollToDate(date: GanttDateInput): void;
    scrollToTask(id: RowId): void;
    scrollTo(options: {
        readonly top?: number;
        readonly left?: number;
    }): void;
    setSplitterPosition(position: number | string): void;
    openAddDialog(): void;
    openEditDialog(id: RowId): void;
    closeDialog(): void;
    undo(): void;
    redo(): void;
    getUndoActions(): readonly string[];
    getRedoActions(): readonly string[];
    clearUndo(): void;
    clearRedo(): void;
    setLoading(loading: boolean): void;
    getState(): GanttState;
    restoreState(state: GanttState): void;
    exportToExcel(options?: GanttGridExportOptions<Row> & {
        readonly sheetName?: string;
    }): Promise<GanttExportFile<Uint8Array> | null>;
    exportToCsv(options?: GanttGridExportOptions<Row> & {
        readonly separator?: string;
        readonly escapeFormulas?: boolean;
    }): Promise<GanttExportFile<string> | null>;
    exportToPdf(options?: GanttPdfExportOptions<Row>): Promise<GanttExportFile<Uint8Array> | null>;
    print(): void;
    getTaskbarElement(id: RowId): HTMLElement | null;
    getChartElement(): HTMLElement | null;
}
```

`ref`; extends the grid pane's `DataGridApi`.

Members (186):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `grid` | `readonly grid: DataGridApi<Row>;` |  |  |
| `getTask` | `getTask(id: RowId): Row \| undefined;` |  |  |
| `getTaskInfo` | `getTaskInfo(id: RowId): GanttTaskInfo \| undefined;` |  |  |
| `getViewRows` | `getViewRows(): readonly Row[];` |  |  |
| `getCriticalTasks` | `getCriticalTasks(): readonly Row[];` |  |  |
| `formatDuration` | `formatDuration(id: RowId): string;` |  |  |
| `formatWork` | `formatWork(id: RowId): string;` |  |  |
| `addTask` | `addTask(task?: Partial<Row>, options?: {     readonly position?: 'top' \| 'bottom' \| 'above' \| 'below' \| 'child';     readonly targetId?: RowId; }): GanttActionResult;` |  |  |
| `updateTask` | `updateTask(id: RowId, changes: Partial<Row>): GanttActionResult;` |  |  |
| `deleteTasks` | `deleteTasks(ids: RowId \| readonly RowId[]): GanttActionResult;` |  |  |
| `changeTaskId` | `changeTaskId(id: RowId, newId: RowId): GanttActionResult;` |  |  |
| `cancelEdit` | `cancelEdit(): void;` |  |  |
| `indent` | `indent(ids: RowId \| readonly RowId[]): GanttActionResult;` |  |  |
| `outdent` | `outdent(ids: RowId \| readonly RowId[]): GanttActionResult;` |  |  |
| `moveTasks` | `moveTasks(ids: RowId \| readonly RowId[], targetId: RowId, position: 'above' \| 'below' \| 'child'): GanttActionResult;` |  |  |
| `addDependency` | `addDependency(taskId: RowId, dependency: Dependency \| string): GanttActionResult;` |  |  |
| `removeDependency` | `removeDependency(taskId: RowId, predecessorId: RowId): GanttActionResult;` |  |  |
| `updateDependencies` | `updateDependencies(taskId: RowId, dependencies: readonly Dependency[] \| string): GanttActionResult;` |  |  |
| `splitTask` | `splitTask(id: RowId, date: GanttDateInput): GanttActionResult;` |  |  |
| `mergeSegments` | `mergeSegments(id: RowId, segmentIndexes: readonly number[]): GanttActionResult;` |  |  |
| `convertToMilestone` | `convertToMilestone(id: RowId): GanttActionResult;` |  |  |
| `convertToTask` | `convertToTask(id: RowId): GanttActionResult;` |  |  |
| `setTaskMode` | `setTaskMode(id: RowId, mode: 'auto' \| 'manual'): GanttActionResult;` |  |  |
| `setProjectDates` | `setProjectDates(start: GanttDateInput, end: GanttDateInput): void;` |  |  |
| `expandAll` | `expandAll(): void;` |  |  |
| `collapseAll` | `collapseAll(): void;` |  |  |
| `expandRows` | `expandRows(ids: RowId \| readonly RowId[]): void;` |  |  |
| `collapseRows` | `collapseRows(ids: RowId \| readonly RowId[]): void;` |  |  |
| `zoomIn` | `zoomIn(): void;` |  |  |
| `zoomOut` | `zoomOut(): void;` |  |  |
| `zoomToFit` | `zoomToFit(): void;` |  |  |
| `getZoom` | `getZoom(): number;` |  |  |
| `extendTimeline` | `extendTimeline(side: 'start' \| 'end'): void;` |  |  |
| `scrollToDate` | `scrollToDate(date: GanttDateInput): void;` |  |  |
| `scrollToTask` | `scrollToTask(id: RowId): void;` |  |  |
| `scrollTo` | `scrollTo(options: {     readonly top?: number;     readonly left?: number; }): void;` |  |  |
| `setSplitterPosition` | `setSplitterPosition(position: number \| string): void;` |  |  |
| `openAddDialog` | `openAddDialog(): void;` |  |  |
| `openEditDialog` | `openEditDialog(id: RowId): void;` |  |  |
| `closeDialog` | `closeDialog(): void;` |  |  |
| `undo` | `undo(): void;` |  |  |
| `redo` | `redo(): void;` |  |  |
| `getUndoActions` | `getUndoActions(): readonly string[];` |  |  |
| `getRedoActions` | `getRedoActions(): readonly string[];` |  |  |
| `clearUndo` | `clearUndo(): void;` |  |  |
| `clearRedo` | `clearRedo(): void;` |  |  |
| `setLoading` | `setLoading(loading: boolean): void;` |  |  |
| `getState` | `getState(): GanttState;` |  |  |
| `restoreState` | `restoreState(state: GanttState): void;` |  |  |
| `exportToExcel` | `exportToExcel(options?: GanttGridExportOptions<Row> & {     readonly sheetName?: string; }): Promise<GanttExportFile<Uint8Array> \| null>;` |  | The grid pane's Excel export with the Data Grid `cell` / `headerCell` hooks; tree rows as outline levels. |
| `exportToCsv` | `exportToCsv(options?: GanttGridExportOptions<Row> & {     readonly separator?: string;     readonly escapeFormulas?: boolean; }): Promise<GanttExportFile<string> \| null>;` |  |  |
| `exportToPdf` | `exportToPdf(options?: GanttPdfExportOptions<Row>): Promise<GanttExportFile<Uint8Array> \| null>;` |  |  |
| `print` | `print(): void;` |  |  |
| `getTaskbarElement` | `getTaskbarElement(id: RowId): HTMLElement \| null;` |  |  |
| `getChartElement` | `getChartElement(): HTMLElement \| null;` |  |  |
| `getColumn` | `getColumn: (fieldOrId: string) => CompiledColumn<Row> \| undefined;` | inherited | Leaf column by column id, else the first leaf with that `field`. |
| `getColumns` | `getColumns: () => readonly CompiledColumn<Row>[];` | inherited | Every leaf column in definition order, including hidden ones. |
| `getVisibleColumns` | `getVisibleColumns: () => readonly CompiledColumn<Row>[];` | inherited | Visible leaves in runtime order. |
| `getHiddenColumns` | `getHiddenColumns: () => readonly CompiledColumn<Row>[];` | inherited | Leaves hidden at runtime, in definition order. |
| `getColumnAt` | `getColumnAt: (index: number) => CompiledColumn<Row> \| undefined;` | inherited | Visible leaf at an index of `getVisibleColumns()`. |
| `getColumnIndex` | `getColumnIndex: (fieldOrId: string) => number;` | inherited | Index of a column in `getVisibleColumns()`, or -1. |
| `showColumns` | `showColumns: (fieldsOrIds: string \| readonly string[]) => CommandResult;` | inherited |  |
| `hideColumns` | `hideColumns: (fieldsOrIds: string \| readonly string[]) => CommandResult;` | inherited |  |
| `getFilteredRows` | `getFilteredRows: () => readonly Row[];` | inherited | Rows passing search and every filter, in sort order, across every page, as raw references. Without the `filter` module, every row. |
| `getRow` | `getRow: (rowId: string) => Row \| undefined;` | inherited |  |
| `getRowIndex` | `getRowIndex: (rowId: string) => number;` | inherited | Visible index of a row, or -1. |
| `getRowIdAt` | `getRowIdAt: (index: number) => string \| undefined;` | inherited | Row id at a visible index (the inverse of `getRowIndex`), or undefined. |
| `getCell` | `getCell: (rowId: string, field: string) => CellSnapshot \| undefined;` | inherited |  |
| `getDataSource` | `getDataSource: () => DataSource<Row>;` | inherited |  |
| `getPrimaryKeyFields` | `getPrimaryKeyFields: () => readonly string[];` | inherited | `field` of each `primaryKey` leaf column, in column order. |
| `getColumnFacet` | `getColumnFacet: (field: string, options?: FacetOptions \| undefined) => ColumnFacet \| undefined;` | inherited | Distinct values with counts for checkbox / Excel filters, or undefined without the `filter` module. |
| `getPageInfo` | `getPageInfo: () => PageInfo \| undefined;` | inherited | Pager model, or undefined without the `paging` module. |
| `groupColumn` | `groupColumn: (field: string, index?: number \| undefined) => CommandResult;` | inherited | Needs the `grouping` module. |
| `ungroupColumn` | `ungroupColumn: (field: string) => CommandResult;` | inherited |  |
| `clearGrouping` | `clearGrouping: () => CommandResult;` | inherited |  |
| `toggleGroup` | `toggleGroup: (group: GroupTarget, expanded?: boolean \| undefined) => CommandResult;` | inherited | Toggles (or sets) one group by row id, path key, or path. |
| `expandAllGroups` | `expandAllGroups: () => CommandResult;` | inherited |  |
| `collapseAllGroups` | `collapseAllGroups: () => CommandResult;` | inherited |  |
| `getGroup` | `getGroup: (rowId: string) => GroupRowSnapshot \| undefined;` | inherited | Caption or footer snapshot of a group row id, or undefined. |
| `getAggregates` | `getAggregates: (groupId?: string \| undefined) => Readonly<Record<string, Readonly<Record<string, unknown>>>> \| undefined;` | inherited | Without an argument the footer aggregates (undefined without the `aggregates` module); with a group row id that group's aggregates (undefined for an unknown id). |
| `refresh` | `refresh: () => void;` | inherited | Re-reads the data with the current query and keeps the grid state: `engine.refresh()`. |
| `dispose` | `dispose: () => void;` | inherited |  |
| `resetState` | `resetState: () => RestoreResult;` | inherited | Restores the state captured when this API was created. |
| `pinColumn` | `pinColumn: (field: string, pinned: DataGridColumnPin \| null) => CommandResult;` | inherited | Pins a column (id or field) to a side or unpins it (`null`). |
| `openColumnChooser` | `openColumnChooser: (position?: { readonly x: number; readonly y: number; } \| undefined) => void;` | inherited | Opens the column chooser; at the given viewport point, else at the grid start. |
| `openColumnMenu` | `openColumnMenu: (field: string) => void;` | inherited |  |
| `openFilterMenu` | `openFilterMenu: (field: string) => void;` | inherited |  |
| `closeOverlays` | `closeOverlays: () => void;` | inherited | Closes any open menu, dialog, or chooser (focus returns to its invoker). |
| `registerCommandHandler` | `registerCommandHandler: (command: DataGridUiCommand \| (string & {}), handler: DataGridCommandHandler) => () => void;` | inherited | Registers the handler of a UI command (toolbar, menus); returns the unregister function. |
| `runCommand` | `runCommand: (command: DataGridUiCommand \| (string & {}), payload?: Readonly<Record<string, unknown>> \| undefined) => boolean;` | inherited | Runs a UI command (handler, then a module command, else a dev warning). Returns true when handled. |
| `getHeaderElement` | `getHeaderElement: (field: string) => HTMLElement \| null;` | inherited | Header cell of a column (id or field); `null` outside the rendered window. |
| `getPartElement` | `getPartElement: (part: DataGridPart) => HTMLElement \| null;` | inherited | First rendered element of a part; `null` when it is not rendered. |
| `openSortDialog` | `openSortDialog: () => void;` | inherited | Opens the sort sheet (`showAdaptiveSortDialog`). |
| `openFilterDialog` | `openFilterDialog: (field?: string \| undefined) => void;` | inherited | Opens the filter sheet of `field`, or the list of filterable columns (`showAdaptiveFilterDialog`). |
| `isAdaptive` | `isAdaptive: () => boolean;` | inherited | True while the adaptive layout applies (derived from the measured container width). *Salmon* |
| `copy` | `copy: (options?: DataGridCopyOptions \| undefined) => CommandResult;` | inherited | Copies the cell range, else the selected rows, else the focused cell to the system clipboard (drafts included). Falls back to a copy dialog when the browser blocks clipboard access. `rejected` with `nothingToCopy` or `cancelled` (`onBeforeCopy`). |
| `paste` | `paste: (text?: string \| undefined) => CommandResult;` | inherited | Pastes TSV `text` at the selected range or focused cell. Without `text`, reads the system clipboard (`async`), or opens a paste dialog when the Clipboard API is unavailable. |
| `startEdit` | `startEdit: (rowId?: string \| undefined, field?: string \| undefined) => CommandResult;` | inherited | Row and dialog mode edit the row, batch and cell mode the cell. Without a row id: the first selected row. |
| `save` | `save: () => CommandResult;` | inherited | Saves: the active row or cell; in batch mode every pending change. |
| `saveCell` | `saveCell: () => CommandResult;` | inherited | Commits the active editor only (batch mode keeps the change pending). |
| `addRow` | `addRow: (row?: Readonly<Record<string, unknown>> \| undefined, index?: number \| undefined) => CommandResult;` | inherited | Index 0 adds at the top, at or past the end at the bottom. |
| `deleteRows` | `deleteRows: (rowIds?: string \| readonly string[] \| undefined) => CommandResult;` | inherited | Without ids: the selected rows. Batch mode marks the rows until save. |
| `updateRow` | `updateRow: (rowId: string, row: Readonly<Record<string, unknown>>) => CommandResult;` | inherited |  |
| `updateCell` | `updateCell: (rowId: string, field: string, value: unknown) => CommandResult;` | inherited | Edits a cell as a user would (draft in batch mode). |
| `setCellValue` | `setCellValue: (rowId: string, field: string, value: unknown) => CommandResult;` | inherited | Silent data updates without the edit lifecycle (local sources). |
| `setRowData` | `setRowData: (rowId: string, row: Row) => CommandResult;` | inherited |  |
| `applyChanges` | `applyChanges: (changes: EditDataChanges<Row>) => CommandResult;` | inherited |  |
| `getPendingChanges` | `getPendingChanges: () => EditBatchChanges<Row>;` | inherited |  |
| `getBatchPreview` | `getBatchPreview: () => EditPreview \| undefined;` | inherited |  |
| `getEditSnapshot` | `getEditSnapshot: () => EditSnapshot \| undefined;` | inherited |  |
| `hasUnsavedChanges` | `hasUnsavedChanges: () => boolean;` | inherited |  |
| `whenEditSettled` | `whenEditSettled: () => Promise<void>;` | inherited |  |
| `validateBatch` | `validateBatch: () => Promise<boolean>;` | inherited | Validates every pending change without saving; resolves true when valid. |
| `fillSelection` | `fillSelection: (rowId: string, field: string) => CommandResult;` | inherited | Fills the selected cell range's content over the range extended to `field` of `rowId` (fill handle). |
| `sortColumn` | `sortColumn: (field: string, direction: DataGridSortDirection, options?: { multiple?: boolean; } \| undefined) => CommandResult;` | inherited | Sorts by a column; `multiple` adds it to a multi-column sort. |
| `removeSort` | `removeSort: (field: string) => CommandResult;` | inherited |  |
| `clearSorting` | `clearSorting: () => CommandResult;` | inherited |  |
| `filterColumn` | `filterColumn: (field: string, operator: DataGridFilterOperator, value: Json, options?: { logic?: "and" \| "or"; matchCase?: boolean; ignoreAccents?: boolean; } \| undefined) => CommandResult;` | inherited | Replaces the column's top-level conditions with one condition (an array value with a scalar operator ORs one condition per value). |
| `removeFilter` | `removeFilter: (field: string) => CommandResult;` | inherited | Removes the filters of one column. |
| `clearFiltering` | `clearFiltering: (fields?: string \| readonly string[] \| undefined) => CommandResult;` | inherited | Removes the filters of the given columns, or every filter. |
| `search` | `search: (text: string) => CommandResult;` | inherited |  |
| `clearSearch` | `clearSearch: () => CommandResult;` | inherited |  |
| `goToPage` | `goToPage: (page: number) => CommandResult;` | inherited |  |
| `setPageSize` | `setPageSize: (pageSize: number) => CommandResult;` | inherited |  |
| `expandDetail` | `expandDetail: (rowId: string) => CommandResult;` | inherited |  |
| `collapseDetail` | `collapseDetail: (rowId: string) => CommandResult;` | inherited |  |
| `toggleDetail` | `toggleDetail: (rowId: string, expanded?: boolean \| undefined) => CommandResult;` | inherited | Toggles one detail row; `expanded` forces a state. |
| `expandAllDetails` | `expandAllDetails: () => CommandResult;` | inherited |  |
| `collapseAllDetails` | `collapseAllDetails: () => CommandResult;` | inherited |  |
| `isDetailExpanded` | `isDetailExpanded: (rowId: string) => boolean;` | inherited |  |
| `getChildGrid` | `getChildGrid: (rowId: string) => DataGridApi<unknown> \| null;` | inherited | The mounted child grid of a parent row (null when collapsed or not rendered). |
| `moveRows` | `moveRows: (rowIds: string \| readonly string[], to: number \| DataGridMoveTarget) => CommandResult;` | inherited | Moves rows so the first one ends at data row index `toIndex`, or next to / into a target row (`{ targetRowId, position }`; `into` makes them the last children of the target in tree mode). |
| `expandAllTreeRows` | `expandAllTreeRows: () => CommandResult;` | inherited |  |
| `collapseAllTreeRows` | `collapseAllTreeRows: () => CommandResult;` | inherited |  |
| `expandTreeLevel` | `expandTreeLevel: (depth: number) => CommandResult;` | inherited | Expands the parents at `depth` (0: roots). |
| `collapseTreeLevel` | `collapseTreeLevel: (depth: number) => CommandResult;` | inherited |  |
| `expandTreeRows` | `expandTreeRows: (rowIds: string \| readonly string[]) => CommandResult;` | inherited |  |
| `collapseTreeRows` | `collapseTreeRows: (rowIds: string \| readonly string[]) => CommandResult;` | inherited |  |
| `toggleTreeRow` | `toggleTreeRow: (rowId: string, expanded?: boolean \| undefined) => CommandResult;` | inherited |  |
| `indentRows` | `indentRows: (rowIds: string \| readonly string[]) => CommandResult;` | inherited | Moves rows under their previous sibling. |
| `outdentRows` | `outdentRows: (rowIds: string \| readonly string[]) => CommandResult;` | inherited | Moves rows after their parent, as its siblings. |
| `getTreeRow` | `getTreeRow: (rowId: string) => DataGridTreeRowInfo \| null;` | inherited |  |
| `getChildRows` | `getChildRows: (rowId: string \| null) => readonly Row[];` | inherited | Kept children of a row in view order (`null`: the roots). |
| `reloadTreeChildren` | `reloadTreeChildren: (rowId: string) => CommandResult;` | inherited | *Salmon*: retries a failed lazy child load. |
| `getVisibleRows` | `getVisibleRows: () => readonly Row[];` | inherited | Visible data rows in view order. |
| `pinRows` | `pinRows: (rowIds: string \| readonly string[]) => CommandResult;` | inherited | Pins rows to the top zone (rejected unless `isRowPinned` or `defaultPinnedRows` is set). |
| `unpinRows` | `unpinRows: (rowIds: string \| readonly string[]) => CommandResult;` | inherited | Unpins rows, also rows `isRowPinned` matches. |
| `isRowPinned` | `isRowPinned: (rowId: string) => boolean;` | inherited | True when the row is pinned, whether or not the current filter shows it. |
| `getPinnedRowIds` | `getPinnedRowIds: () => readonly string[];` | inherited | Ids of the pinned rows shown, in display order. |
| `openFilterBuilder` | `openFilterBuilder: () => void;` | inherited | Opens the filter builder dialog. Ignored unless `filtering.builder` is set. |
| `closeFilterBuilder` | `closeFilterBuilder: () => void;` | inherited | Closes the filter builder dialog without applying. |
| `getViewport` | `getViewport: () => DataGridViewport;` | inherited | Scroll sync extension point: the current body viewport. |
| `subscribeViewport` | `subscribeViewport: (listener: () => void) => () => void;` | inherited | Calls `listener` outside React on every body scroll and layout change; returns the unsubscribe function. |
| `getRowOffsets` | `getRowOffsets: () => RowMetrics;` | inherited | Row height extension point: the row offsets of the visible row model (the body's own prefix sums). |
| `getPageSizeForHeight` | `getPageSizeForHeight: (height: number) => number;` | inherited | Whole data rows that fit in `height` px after the toolbar, group drop area, header rows, footer aggregate rows and pager; 0 when none fit. Rows count `rowHeight` (the estimate with measured rows, the card height in adaptive vertical mode). Before mount only the header and footer rows are subtracted. |
| `selectRows` | `selectRows: (rowIds: string \| readonly string[], options?: { mode?: "add" \| "remove" \| "replace" \| "toggle"; } \| undefined) => CommandResult;` | inherited |  |
| `selectRowRange` | `selectRowRange: (fromRowId: string, toRowId: string, options?: { mode?: "add" \| "replace"; } \| undefined) => CommandResult;` | inherited |  |
| `selectAll` | `selectAll: (options?: { scope?: "filtered" \| "page"; } \| undefined) => CommandResult;` | inherited | `page`: every row of the current page (all rows without paging). `filtered` (default with paging off): every row matching the query, O(1). |
| `clearSelection` | `clearSelection: (parts?: { rows?: boolean; cells?: boolean; columns?: boolean; } \| undefined) => CommandResult;` | inherited |  |
| `selectCells` | `selectCells: (cells: readonly DataGridCellKey[], options?: { mode?: "add" \| "replace" \| "toggle"; } \| undefined) => CommandResult;` | inherited |  |
| `selectCellRange` | `selectCellRange: (anchor: DataGridCellKey, focus: DataGridCellKey, options?: { mode?: "add" \| "replace"; } \| undefined) => CommandResult;` | inherited |  |
| `selectColumns` | `selectColumns: (fields: string \| readonly string[], options?: { mode?: "add" \| "replace" \| "toggle"; } \| undefined) => CommandResult;` | inherited |  |
| `isRowSelected` | `isRowSelected: (rowId: string) => boolean;` | inherited |  |
| `getSelectedRowIds` | `getSelectedRowIds: () => readonly string[];` | inherited |  |
| `getSelectedRows` | `getSelectedRows: () => readonly Row[];` | inherited | Raw rows, in the order of `getSelectedRowIds()`. |
| `getSelectedCells` | `getSelectedCells: () => readonly DataGridCellKey[];` | inherited |  |
| `getSelectedColumns` | `getSelectedColumns: () => readonly string[];` | inherited |  |
| `getSelection` | `getSelection: () => SerializedSelection \| undefined;` | inherited | Serializable selection (scope, ids or excluded ids, cell ranges, columns). |
| `setSelection` | `setSelection: (selection: SerializedSelection) => CommandResult;` | inherited |  |
| `getSelectionSummary` | `getSelectionSummary: () => SelectionSummary \| undefined;` | inherited |  |
| `engine` | `engine: DataGridApiEngine<Row>;` | inherited | The engine, with the façades of the optional modules a prop registers (`infiniteScroll`). |
| `element` | `element: HTMLDivElement \| null;` | inherited | The root element; null before mount and after unmount. |
| `focus` | `focus: () => void;` | inherited | Focuses the grid content: the focused body cell, else the last focused body cell, else the first body cell (also from the header, like Alt+W). |
| `focusCell` | `focusCell: (rowId: string, field: string) => void;` | inherited | Scrolls the cell into view and focuses it. |
| `focusHeader` | `focusHeader: (field: string) => void;` | inherited |  |
| `getFocusedCell` | `getFocusedCell: () => DataGridFocusedCell \| null;` | inherited |  |
| `registerKeyHandler` | `registerKeyHandler: (command: string, handler: DataGridKeyHandler, options?: { priority?: number; } \| undefined) => () => void;` | inherited | Registers a handler for a keyboard command (`DEFAULT_KEY_BINDINGS`); higher priority runs first. Returns the unregister function. |
| `getRowInfo` | `getRowInfo: (target: string \| Element \| EventTarget \| null) => DataGridRowInfo<Row> \| undefined;` | inherited | Row info by row id, or by any element inside a row (cell, custom template content). |
| `getRowElement` | `getRowElement: (rowId: string) => HTMLElement \| null;` | inherited |  |
| `getCellElement` | `getCellElement: (rowId: string, field: string) => HTMLElement \| null;` | inherited |  |
| `scrollToRow` | `scrollToRow: (rowId: string, options?: DataGridScrollOptions \| undefined) => void;` | inherited |  |
| `scrollToColumn` | `scrollToColumn: (field: string, options?: DataGridScrollOptions \| undefined) => void;` | inherited |  |
| `autoSizeColumns` | `autoSizeColumns: (fields?: string \| readonly string[] \| undefined) => void;` | inherited | Fits widths to header and rendered content; every visible column when omitted. |
| `setColumnWidth` | `setColumnWidth: (field: string, width: number) => CommandResult;` | inherited |  |
| `moveColumn` | `moveColumn: (field: string, toIndex: number) => CommandResult;` | inherited |  |
| `getRenderedRange` | `getRenderedRange: () => { readonly rows: VirtualRange; readonly columns: VirtualRange; };` | inherited | Rendered row range and center column range (overscan included). |
