Skip to main content

Interface: ColumnToggle

Defined in: model/field.ts:88

How a toggle column looks and acts. The column's Field is type: 'boolean'.

A user switches the value with one click, or with Space or Enter on the focused cell. The cell opens no editor. The Field's editable, the lock rule, capabilities.edit and beforeChange decide whether the toggle acts. A closed toggle draws its value, does nothing, and carries aria-readonly="true". An open toggle carries no aria-readonly.

Properties​

off?​

optional off?: ElementDescription

Defined in: model/field.ts:92

What the cell draws when the value is false or empty. Default: an empty box.


on?​

optional on?: ElementDescription

Defined in: model/field.ts:90

What the cell draws when the value is true. Default: a checked box.


onToggle?​

optional onToggle?: (ctx) => void

Defined in: model/field.ts:98

Replaces the default write. Runs only when the toggle is open. Write through the public API, for example dataset.entries.update(entry.id, { done: nextValue }), or write nothing. The write meets the same gates. The library fires beforeEntryEdit before this call. The default write announces entryEdit itself. Your write does not. Call ctx.announceEdit() after it, or entryEdit listeners never see the switch.

Parameters​

ctx​

ColumnToggleContext

Returns​

void