@kanunilabs/datagrid-react / GridColumnDef
Interface: GridColumnDef<TRow>
Defined in: datagrid-core/dist/index.d.ts:503
Extended by
Type Parameters
TRow
TRow = GridRowData
Properties
align?
optionalalign?:ColumnAlign
Defined in: datagrid-core/dist/index.d.ts:562
band?
optionalband?:string|string[]
Defined in: datagrid-core/dist/index.d.ts:518
Caption(s) of the band row(s) above this column's header — 'Sales' for
one level, ['Contact', 'Address'] for two.
A PATH on the column rather than a nested column tree: the flat list is what carries width, order, pinning, visibility, persistence and virtualization, so keeping the model flat means banding costs nothing in the pipeline. Adjacent columns with the same path merge into one band cell.
bandShow?
optionalbandShow?:"open"|"closed"
Defined in: datagrid-core/dist/index.d.ts:530
Whether this column survives its band being collapsed (gap analysis P2.6).
- omitted — always shown; collapsing the band does not affect it
'open'— only while the band is OPEN (the detail columns)'closed'— only while the band is COLLAPSED (the summary that stands in for them)
A band with no column declaring either is not collapsible: there would be nothing to hide, and a toggle that does nothing is worse than no toggle.
calculateSortValue?
optionalcalculateSortValue?: (row) =>unknown
Defined in: datagrid-core/dist/index.d.ts:583
Sort on a derived value (e.g. custom ordering) instead of the cell value.
Parameters
row
TRow
Returns
unknown
comparator?
optionalcomparator?: (valueA,valueB,rowA,rowB,descending) =>number
Defined in: datagrid-core/dist/index.d.ts:606
Order this column by an arbitrary rule (gap analysis P1.8) — the escape
hatch for orderings no data type describes: a T-shirt size scale, a
domain-specific priority, a locale rule Intl.Collator gets wrong.
Prefer calculateSortValue when the rule can be expressed as a value to
sort BY. That keeps the fast paths; this one closes them for this column:
• the radix/typed-array sort cannot run — a byte order cannot be derived from a function, so the column falls back to a comparator sort; • the WORKER cannot run the query at all — functions are unclonable, so a sort touching this column stays on the main thread whatever the row count. Correctness is preserved; the speed is what is spent.
The values arrive exactly as the column produces them, null/undefined
INCLUDED: a custom order usually wants to place its own blanks, and the
built-in "nils last" rule would pre-empt that decision.
descending is informational — the grid already inverts the result for a
descending sort. It exists for rules that must NOT flip (keeping a
"Total" row last in both directions).
Parameters
valueA
unknown
valueB
unknown
rowA
TRow
rowB
TRow
descending
boolean
Returns
number
dataType?
optionaldataType?:GridDataType
Defined in: datagrid-core/dist/index.d.ts:558
dateFormat?
optionaldateFormat?:string
Defined in: datagrid-core/dist/index.d.ts:617
How a date column is written and typed — 'dd.MM.yyyy', 'MM/dd/yyyy',
'dd/MM/yy', any separator. Defaults to 'yyyy-MM-dd'.
Governs BOTH directions: the cell renders through it, and the editor masks keystrokes into it, so what the user types back is the shape they were shown. Ignored on any other data type.
editable?
optionaleditable?:boolean
Defined in: datagrid-core/dist/index.d.ts:574
Editable in an Enterprise grid with editing on. Defaults to true; set false for a computed or server-owned column so the editor never opens on it.
excelFormat?
optionalexcelFormat?:string
Defined in: datagrid-core/dist/index.d.ts:624
Excel number format for the styled export (e.g. '#,##0.00', '"$"#,##0',
'0.0%'). Without it a number column gets a plain thousands separator —
currency and percent are never guessed, because guessing changes what the
number means.
field?
optionalfield?:string
Defined in: datagrid-core/dist/index.d.ts:507
Property read from the row object (dot paths NOT expanded — use valueGetter).
filterable?
optionalfilterable?:boolean
Defined in: datagrid-core/dist/index.d.ts:566
groupable?
optionalgroupable?:boolean
Defined in: datagrid-core/dist/index.d.ts:569
headerName?
optionalheaderName?:string
Defined in: datagrid-core/dist/index.d.ts:508
id?
optionalid?:string
Defined in: datagrid-core/dist/index.d.ts:505
Stable identity; defaults to field. Required when two columns share a field.
lookup?
optionallookup?:ColumnLookup<TRow>
Defined in: datagrid-core/dist/index.d.ts:579
Value list for a code→label column. Drives the select editor, and (for a static list) the displayed text.
maxWidth?
optionalmaxWidth?:number
Defined in: datagrid-core/dist/index.d.ts:561
minWidth?
optionalminWidth?:number
Defined in: datagrid-core/dist/index.d.ts:560
pin?
optionalpin?:ColumnPin
Defined in: datagrid-core/dist/index.d.ts:563
reorderable?
optionalreorderable?:boolean
Defined in: datagrid-core/dist/index.d.ts:568
resizable?
optionalresizable?:boolean
Defined in: datagrid-core/dist/index.d.ts:567
sortable?
optionalsortable?:boolean
Defined in: datagrid-core/dist/index.d.ts:565
spanRows?
optionalspanRows?:boolean|SpanComparator<TRow>
Defined in: datagrid-core/dist/index.d.ts:557
Merge this column's cell down over consecutive rows holding the same value (gap analysis P3.1).
Computed over the CURRENT view, which is the point: sorting a column into
A A A B B is what makes the merge meaningful, and the same rows unsorted
merge nothing. Blanks never merge, a group banner interrupts a run, and a
run of one is left as an ordinary cell.
true compares with Object.is. Pass a function for values that need
their own notion of equality — a column of objects, or a case-insensitive
code.
The merged block is still N cells to everything else: selection, editing, the clipboard and export see the rows the data has. Only the DRAWING is merged, which is what a reader means by it.
sparkline?
optionalsparkline?:ColumnSparkline
Defined in: datagrid-core/dist/index.d.ts:539
Draw this column's value as an in-cell chart (gap analysis P2.2).
The cell's value must be an ARRAY of numbers — a series per row. Config
lives here, next to band and lookup, because it is data description
rather than rendering: which numbers, and against what scale. The drawing
belongs to the adapter, and the packaged renderer is Enterprise.
valueFormatter?
optionalvalueFormatter?: (value,row) =>string
Defined in: datagrid-core/dist/index.d.ts:608
Display formatting hook (adapters render the returned string).
Parameters
value
unknown
row
TRow
Returns
string
valueGetter?
optionalvalueGetter?: (row) =>unknown
Defined in: datagrid-core/dist/index.d.ts:581
Derive the cell value; overrides field access.
Parameters
row
TRow
Returns
unknown
visible?
optionalvisible?:boolean
Defined in: datagrid-core/dist/index.d.ts:564
width?
optionalwidth?:number
Defined in: datagrid-core/dist/index.d.ts:559