Skip to main content
zerotal

Documentation


Documentation / @zerotal/admin / index / Group

Class: Group

Defined in: admin/src/table/Group.ts:14

Row grouping for the list table. A resource lists the groupings it supports via static groups(); the list page offers a "Group by" menu and renders a header row before each group's rows.

static groups() { return [ group("status"), group("created_at").label("Joined").getTitleUsing((r) => formatMonth(r.created_at)), ]; } static defaultGroup = "status";

Constructors

Constructor

new Group(column): Group

Defined in: admin/src/table/Group.ts:20

Parameters

column

string

Returns

Group

Methods

make()

static make(column): Group

Defined in: admin/src/table/Group.ts:24

Parameters

column

string

Returns

Group


label()

label(label): this

Defined in: admin/src/table/Group.ts:29

Heading label for the grouping (defaults to a title-cased column).

Parameters

label

string

Returns

this


getTitleUsing()

getTitleUsing(fn): this

Defined in: admin/src/table/Group.ts:35

Derive each group's title from a row (e.g. bucket a date into a month).

Parameters

fn

(row) => string

Returns

this


collapsible()

collapsible(value?): this

Defined in: admin/src/table/Group.ts:40

Parameters

value?

boolean = true

Returns

this


getColumn()

getColumn(): string

Defined in: admin/src/table/Group.ts:46

The grouping's column key (also its stable identifier).

Returns

string


getLabel()

getLabel(): string

Defined in: admin/src/table/Group.ts:50

Returns

string


titleFor()

titleFor(row): string

Defined in: admin/src/table/Group.ts:55

The group title for a given row.

Parameters

row

Record<string, unknown>

Returns

string