View as Markdown

API reference: @salmonui/data-grid

DataGridColumnChooserContextinterface

import type { DataGridColumnChooserContext } from '@salmonui/data-grid';
interface DataGridColumnChooserContext<Row = unknown> {
    readonly columns: readonly DataGridColumnChooserItem<Row>[];
    readonly searchText: string;
    setSearchText(text: string): void;
    setHidden(fields: string | readonly string[], hidden: boolean): void;
    apply(): void;
    close(): void;
    readonly defaultContent: ReactNode;
}

Context of columnChooser.renderChooser, renderHeader, and renderFooter.

DataGridColumnChooserContext members (7)
NameSignatureDescription
columnsreadonly columns: readonly DataGridColumnChooserItem<Row>[];

Hideable leaf columns in definition order.

searchTextreadonly searchText: string;

Current search text (empty without searchable).

setSearchTextsetSearchText(text: string): void;
setHiddensetHidden(fields: string | readonly string[], hidden: boolean): void;

Updates the draft visibility (immediate mode applies it at once). At least one column stays visible.

applyapply(): void;

Applies the draft and closes (the OK button).

closeclose(): void;

Discards the draft and closes.

defaultContentreadonly defaultContent: ReactNode;

The built-in content the render prop replaces (search box and list, or the OK / Cancel buttons).