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.
| Name | Signature | Description |
|---|---|---|
columns | readonly columns: readonly DataGridColumnChooserItem<Row>[]; | Hideable leaf columns in definition order. |
searchText | readonly searchText: string; | Current search text (empty without |
setSearchText | setSearchText(text: string): void; | |
setHidden | setHidden(fields: string | readonly string[], hidden: boolean): void; | Updates the draft visibility (immediate mode applies it at once). At least one column stays visible. |
apply | apply(): void; | Applies the draft and closes (the OK button). |
close | close(): void; | Discards the draft and closes. |
defaultContent | readonly defaultContent: ReactNode; | The built-in content the render prop replaces (search box and list, or the OK / Cancel buttons). |