Skip to content

@serenity-is/corelib / GridRadioSelectionMixin

Class: GridRadioSelectionMixin

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:24

A mixin that adds single (radio) row selection behavior to a data grid.

Constructors

Constructor

new GridRadioSelectionMixin(grid, options?): GridRadioSelectionMixin

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:68

Creates a new GridRadioSelectionMixin for the given grid.

Parameters

grid

IDataGrid

The data grid to attach the mixin to.

options?

GridRadioSelectionMixinOptions

Optional mixin options.

Returns

GridRadioSelectionMixin

Properties

[typeInfo]

static [typeInfo]: ClassTypeInfo<"Serenity.">

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:26

Accessors

radioColumnId

Get Signature

get static radioColumnId(): string

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:29

The id of the column that shows the radio buttons of the rows, which the mixin creates.

Returns

string

Methods

clear()

clear(): void

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:130

Clears the current selection.

Returns

void


destroy()

destroy(): void

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:107

Detaches the mixin from the grid and cleans up event subscriptions.

Returns

void


getSelectedAsInt32()

getSelectedAsInt32(): number

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:159

Returns the selected key parsed as a 32-bit integer, or null if none is selected.

Returns

number

The selected key as an int32, or null.


getSelectedAsInt64()

getSelectedAsInt64(): number

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:175

Returns the selected key parsed as a 64-bit integer, or null if none is selected.

Returns

number

The selected key as an int64, or null.


getSelectedKey()

getSelectedKey(): string

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:146

Returns the key of the currently selected item, or null if none is selected.

Returns

string

The selected key, or null.


resetCheckedAndRefresh()

resetCheckedAndRefresh(): void

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:137

Clears the current selection and refreshes the grid view.

Returns

void


setSelectedKey()

setSelectedKey(key): void

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:191

Selects the item with the given key, clearing any previous selection.

Parameters

key

string

The key of the item to select.

Returns

void


createSelectColumn()

static createSelectColumn(getMixin, columnOptions?): Column

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:202

Creates a radio select column for the grid.

Parameters

getMixin

() => GridRadioSelectionMixin

A function that returns the mixin instance.

columnOptions?

Partial<Column>

Optional column options to merge into the select column.

Returns

Column

The select column definition.


formatRadioItem()

static formatRadioItem(ctx): FormatterResult

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:38

Formats a cell of the column of the radio buttons that select a row, and is also what tells that column apart from the column of the check boxes, see GridRowSelectionMixin.formatSelectItem, which has an id of its own, __select__, as this one has radioColumnId.

Parameters

ctx

FormatterContext

The formatter context.

Returns

FormatterResult

The radio button of the row, or an empty string for a row that has none.


tryGetInstance()

static tryGetInstance(grid): GridRadioSelectionMixin

Defined in: src/ui/helpers/gridradioselectionmixin.tsx:53

Returns the mixin attached to a grid, if it has one.

Parameters

grid

The data grid, or the sleek grid of it.

ISleekGrid<any> | IDataGrid

Returns

GridRadioSelectionMixin

The mixin, or null when the grid has none.