View as Markdown

API reference: @salmonui/data-grid

DataGridChromeApiinterface

import type { DataGridChromeApi } from '@salmonui/data-grid';
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;
}
DataGridChromeApi members (9)
NameSignatureDescription
pinColumnpinColumn(field: string, pinned: DataGridColumnPin | null): CommandResult;

Pins a column (id or field) to a side or unpins it (null).

openColumnChooseropenColumnChooser(position?: { readonly x: number; readonly y: number; }): void;

Opens the column chooser; at the given viewport point, else at the grid start.

openColumnMenuopenColumnMenu(field: string): void;
openFilterMenuopenFilterMenu(field: string): void;
closeOverlayscloseOverlays(): void;

Closes any open menu, dialog, or chooser (focus returns to its invoker).

registerCommandHandlerregisterCommandHandler(command: DataGridUiCommand | (string & {}), handler: DataGridCommandHandler): () => void;

Registers the handler of a UI command (toolbar, menus); returns the unregister function.

runCommandrunCommand(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.

getHeaderElementgetHeaderElement(field: string): HTMLElement | null;

Header cell of a column (id or field); null outside the rendered window.

getPartElementgetPartElement(part: DataGridPart): HTMLElement | null;

First rendered element of a part; null when it is not rendered.