View as Markdown

API reference: @salmonui/data-grid

DataGridGroupinginterface

import type { DataGridGrouping } from '@salmonui/data-grid';
interface DataGridGrouping<Row> {
    readonly groupBy?: readonly string[];
    readonly showDropArea?: boolean;
    readonly showGroupedColumns?: boolean;
    readonly showHeaderToggle?: boolean;
    readonly showRemoveButton?: boolean;
    readonly reorderable?: boolean;
    readonly defaultExpanded?: boolean;
    readonly lazy?: boolean;
    readonly lazyChunkSize?: number;
    readonly renderCaption?: (ctx: DataGridGroupCaptionContext<Row>) => ReactNode;
}

grouping prop.

DataGridGrouping members (10)
NameSignatureDescription
groupByoptionalreadonly groupBy?: readonly string[];

Grouped fields in order. Reactive. Group order follows sorting.sortBy for the field, else ascending.

showDropAreaoptionalreadonly showDropArea?: boolean;

Group drop area above the header. Default true.

showGroupedColumnsoptionalreadonly showGroupedColumns?: boolean;

Keep grouped columns visible. Default false.

showHeaderToggleoptionalreadonly showHeaderToggle?: boolean;

Group toggle button (aria-pressed) in the header of every groupable column: groups or ungroups by it. Default false. The sort-direction toggle on group chips has no option: it follows sorting (shown when the grid sorts and the column is sortable).

showRemoveButtonoptionalreadonly showRemoveButton?: boolean;

Remove button on group chips. Default true.

reorderableoptionalreadonly reorderable?: boolean;

Reorder group chips by drag and Alt+Arrow keys. Default false.

defaultExpandedoptionalreadonly defaultExpanded?: boolean;

Groups start expanded. Default true (false in lazy mode).

lazyoptionalreadonly lazy?: boolean;

Lazy group loading with a remote source that has capabilities.lazyGroups.

lazyChunkSizeoptionalreadonly lazyChunkSize?: number;

Lazy mode: child rows per load. Default 100.

renderCaptionoptionalreadonly renderCaption?: (ctx: DataGridGroupCaptionContext<Row>) => ReactNode;

Replaces the caption text; the toggle stays.