Skip to content

Column options

A column is a plain object (ColumnDef<T> from @dzgrid/core), the same in TypeScript, in Angular’s [columns] and in the Web Component’s columns property; Angular also takes component classes in ui. Each page gives the key’s facts (its type, its default), what it does, an example and, when it shows something, a live grid. A column’s keys change when you give the columns again: update({ columns }).

One is required: id. The rest are optional. TypeScript flags an unknown key; the grid ignores it.

NameTypeWhat it does
id (required)stringThe column's name for the grid: required, unique and stable.
fieldstringA path into the row, `a.b.c`, where the column reads its value.
value(row: Readonly<T>) => VA function that computes the cell from the whole row.
headerstringThe column's title, already translated.
headerShortstringA shorter title, without unit, where room is short.
typeColumnTypeWhat the cells hold: text, number, day, instant, boolean, enum or custom.
codecValueCodec<V>Your own way to read, show, sort and export the column’s values.
enumOptionsreadonly EnumOption[]The closed list of an `enum` column: each value, its label, its other names.
assumeZonestringThe time zone in which an `instant` column reads a date and time written without an offset.
numberFormatNumberFormatSpecHow a `number` column shows its numbers: decimals, percent, currency, grouping.
instantFormatInstantFormatSpecWhat an `instant` column shows of each moment: the date, the time, the seconds.
widthnumberThe column's width in pixels.
minWidthnumberThe narrowest the column may become, in pixels.
maxWidthnumberThe widest the column may become, in pixels.
flexnumberA share of the room the fixed columns leave.
resizablebooleanWhether the user may change the column’s width.
movablebooleanWhether the column may change place or side.
hideablefalse`false`: the user cannot hide the column.
menufalse`false`: the column has no column menu.
chooserfalse`false`: the column is left out of the columns chooser.
sortableboolean`false`: the column cannot be sorted.
groupableboolean`false`: rows are never grouped by this column.
aggFuncAggFuncName | AggFn<V>The column’s total on group rows, group footers and the grand total.
totalAggFuncName | AggFn<V>The column’s total in the totals row of a flat grid.
headerVerticalbooleanThe column’s title written upwards.
headerWrapbooleanA long title on several lines.
collapsePrioritynumberOn a narrow screen, which columns fold under their rows first.
filterfalse | { readonly kind?: string; readonly floating?: boo…Whether the column can be filtered, and how its filter looks.
pinnedSide | nullKeeps the column at the start or the end, while the others scroll.
hiddenbooleanThe column starts hidden.
align'start' | 'center' | 'end'Where the text sits in the cells: start, center or end.
headerAlign'start' | 'center' | 'end'Where the title sits in the header, when not where the cells’ text sits.
wrapbooleanThe cells’ text wraps on several lines.
ui{ readonly cell?: string; readonly header?: string; reado…Your own drawing and classes for the column’s cells and header.
headerTooltipstringThe text shown over the column’s header, already translated.
tooltip(value: V | null, row: Readonly<T>, context: unknown) => …The text shown over a cell, from its value and row.
mergetrue | ((a: SpanCtx<T>, b: SpanCtx<T>) => boolean) | { re…Consecutive rows with the same value show one tall cell.
rowSpan(ctx: SpanCtx<T>) => numberHow many rows a cell covers, decided from the data.
colSpan(ctx: SpanCtx<T>) => numberHow many columns a cell covers, decided from the data.
groupShow'open' | 'closed'Under a collapsible column group: shown only while it is open, or only while it is closed.
csv'text'`'text'`: a digits-only value keeps its leading zeros in Excel.
editableEditableRule<T>Whether the column’s cells can be edited: yes, or a rule over the row.
validate(value: V | null, row: Readonly<T>, context: unknown) => …Your own check of an edited value: a refusal code, or null.
editEditChecks<T, V>The simple checks of an edited value, and the field that edits it.