Skip to content

Columns

Columns decide what a table looks like in the manager — which values the grid shows, in what order, and how they are rendered.

A column usually points at a field; the field owns the data, the column owns the presentation.

What a column row holds

SettingWhat it does
FieldWhich field this column shows
CaptionHeader override. Empty means the field's label
WidthColumn width in the grid
DefaultShown when the value is empty
SortableClicking the header sorts by this column
SearchableThe column joins the grid's search
OrderPosition among the columns
PublishedAn unpublished column is not rendered

Three kinds of column

A column is not limited to one field. The kind is chosen on the column itself:

field — one value

The ordinary case: one field, one cell.

group — several values in one cell

Several fields shown together in a single column. A city and a country, a width and a height — values that are read as one thing and waste a column each.

By default the values appear bare. Turn with label on and each is captioned with its field's label, which is what you want when the values are not self-explanatory:

Moscow, Russia            ← without labels
City: Moscow  Country: Russia   ← with labels

The default is off on purpose: a column that says nothing keeps the plain values it had before the setting existed.

renderIf — the first value that exists

Several fields tried in order; the first non-empty one wins, and the column's default is used if none do.

This is the fallback ladder you would otherwise write in a renderer: a display name, then a company name, then a login. One column, no empty cells.

Sorting has a limit

A column over a constructor field cannot be sorted. The value lives inside a JSON column, and ordering by it is not something the query can do.

Filtering and search over such fields do work — only ORDER BY does not.

Leave sortable off for constructor fields

Switch it on and the grid does not quietly ignore it — the request fails. If a grid starts erroring after you added a column, this is the first thing to check.

Columns over real table columns sort normally.

Width is a hint, not a promise

The grid distributes what is left after the fixed columns, so a width is respected in proportion rather than in pixels. Set it on the two or three columns whose size matters and leave the rest at zero.

© PageBlocks 2019-present