5.20231.904
wijmo.grid.selector Class Selector Wijmo API Class

Selector Class

Class that modifies a FlexGrid Column by adding checkboxes that can be used to select or de-select rows and groups.

The FlexGrid has a FlexGrid.selectionMode property that allows users to select multiple rows or row ranges using the mouse or the keyboard.

But in some cases you may prefer to provide this functionality by adding a column with checkboxes instead. This will allow users to select rows easily on mobile devices and may provide a more intuitive interface on desktop systems as well.

The Selector class allows you to do this by creating an instance of the Selector class and setting its column property to the column where you want the checkboxes to appear. For example:

// add a SelectorColumn to the first row header column
let selector = new SelectorColumn(theGrid, {
    itemChecked: () => showCheckedCount()
});

This will add checkboxes to cells in the first row header column. The checkboxes are bound to each row's Row.isSelected property, so toggling the checkbox toggles the row's selected state.

By default, the Selector also adds checkboxes to the top header cell and to cells in group rows. These cells can be used to select or de-select all rows on the grid and on each group.

You may use the showCheckAll property to turn off the checkbox at the top header cell.

The Selector can also be added to non header columns. For example:

// add a SelectorColumn to the first row data column
let selector = new SelectorColumn(theGrid.columns[0], {
    itemChecked: () => showCheckedCount()
});

In this case, the Selector will add the selection checkboxes to regular grid cells preserving their original data content.

** Note **: When you attach a Selector to a FlexGrid, it will automatically set the grid's FlexGrid.selectionMode property to SelectionMode.Cell, since that is the selection mode that makes most sense for the type of selection provided by the Selector. (The SelectionMode.ListBox mode would cause the grid to interfere with the selector's behavior.)

Heirarchy

Constructors

constructor

  • Initializes a new instance of the Selector class.

    Parameters

    • Optional column: Column | FlexGrid

      The Column that this Selector should customize, or a reference to a FlexGrid whose first column will be customized.

    • Optional options: any

      An object containing initialization data for the object.

    Returns Selector

Properties

ariaLabel

ariaLabel: string

Gets or sets the aria label property of selector.

The default value for this property is ''.

column

column: Column | null

Gets or sets the Column to be used by this Selector.

showCheckAll

showCheckAll: boolean

Gets or sets a value that determines whether to show a 'Check All' items checkbox on the column header.

The default value for this property is true.

Methods

onColumnChanged

onColumnChanging

onItemChecked

Events

columnChanged

columnChanged: Event<Selector, EventArgs>

Occurs after the value of the column property changes.

columnChanging

columnChanging: Event<Selector, CancelEventArgs>

Occurs before the value of the column property changes.

itemChecked

itemChecked: Event<Selector, EventArgs>

Occurs when the user checks an item on this column.