# DataGridChromeApi (@salmonui/data-grid)

> The DataGridChromeApi interface of @salmonui/data-grid.

Canonical: https://salmonui.dev/docs/reference/data-grid/DataGridChromeApi

```ts
import type { DataGridChromeApi } from '@salmonui/data-grid';
```

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

## Reference

Kind: interface

```ts
interface DataGridChromeApi {
    pinColumn(field: string, pinned: DataGridColumnPin | null): CommandResult;
    openColumnChooser(position?: {
        readonly x: number;
        readonly y: number;
    }): void;
    openColumnMenu(field: string): void;
    openFilterMenu(field: string): void;
    closeOverlays(): void;
    registerCommandHandler(command: DataGridUiCommand | (string & {}), handler: DataGridCommandHandler): () => void;
    runCommand(command: DataGridUiCommand | (string & {}), payload?: Readonly<Record<string, unknown>>): boolean;
    getHeaderElement(field: string): HTMLElement | null;
    getPartElement(part: DataGridPart): HTMLElement | null;
}
```

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `pinColumn` | `pinColumn(field: string, pinned: DataGridColumnPin \| null): CommandResult;` |  | Pins a column (id or field) to a side or unpins it (`null`). |
| `openColumnChooser` | `openColumnChooser(position?: {     readonly x: number;     readonly y: number; }): void;` |  | Opens the column chooser; at the given viewport point, else at the grid start. |
| `openColumnMenu` | `openColumnMenu(field: string): void;` |  |  |
| `openFilterMenu` | `openFilterMenu(field: string): void;` |  |  |
| `closeOverlays` | `closeOverlays(): void;` |  | Closes any open menu, dialog, or chooser (focus returns to its invoker). |
| `registerCommandHandler` | `registerCommandHandler(command: DataGridUiCommand \| (string & {}), handler: DataGridCommandHandler): () => void;` |  | Registers the handler of a UI command (toolbar, menus); returns the unregister function. |
| `runCommand` | `runCommand(command: DataGridUiCommand \| (string & {}), payload?: Readonly<Record<string, unknown>>): boolean;` |  | Runs a UI command (handler, then a module command, else a dev warning). Returns true when handled. |
| `getHeaderElement` | `getHeaderElement(field: string): HTMLElement \| null;` |  | Header cell of a column (id or field); `null` outside the rendered window. |
| `getPartElement` | `getPartElement(part: DataGridPart): HTMLElement \| null;` |  | First rendered element of a part; `null` when it is not rendered. |
