1. Domino UI
  2. Data table
  3. Row selection
Top Single Multi Docs

Row selection

The `SelectionPlugin` class is a DataTable plugin that provides selection functionality for table rows. It allows users to select one or multiple rows, and it provides options for customizing the selection behavior.

T

The type of data in the DataTable rows.

See also :

Examples

Single selection Only one row can be selected at a time.

Multi selection Multiple rows can be selected at a time.

API Docs: SelectionPlugin

Constructors

public void SelectionPlugin()
Creates a new `SelectionPlugin` with default settings.
public void SelectionPlugin(Supplier<Element> singleSelectIndicator)
Creates a new `SelectionPlugin` with a custom single select indicator element.

singleSelectIndicator

A supplier for the single select indicator element.

Public methods

public boolean requiresUtilityColumn()
Indicates whether this plugin requires a utility column in the DataTable. It returns `true` since it adds selection checkboxes to utility columns.

Returns:

`true` since this plugin requires a utility column.

public Optional<List<HTMLElement>> getUtilityElements(DataTable<T> dataTable, RowCell<T> rowCell)
Returns a list of utility elements to be added to utility columns for a specific cell.

dataTable

The DataTable to which this plugin is applied.

rowCell

The cell information containing the cell content and metadata.



Returns:

An optional list of utility elements, empty if none.

public void onAfterAddTable(DataTable<T> dataTable)
This method is called after the DataTable has been added, allowing the plugin to access and reference the DataTable.

dataTable

The DataTable instance to which this plugin is applied.

public void onHeaderAdded(DataTable<T> dataTable, ColumnConfig<T> column)
Handles the addition of headers to the DataTable. In this case, it adds the selection indicator to the utility column header.

dataTable

The DataTable to which this plugin is applied.

column

The column configuration to which the header is added.

public SelectionPlugin<T> setSingleSelectIcon(Supplier<Icon<?>> singleSelectIcon)
Sets the single selection indicator using a supplier of icons.

singleSelectIcon

A supplier for the single selection indicator icon.



Returns:

This `SelectionPlugin` instance for method chaining.

public SelectionPlugin<T> setSelectionCondition(SelectionCondition<T> selectionCondition)
Sets the selection condition for rows in the DataTable.

selectionCondition

A function that determines whether a row is selectable.



Returns:

This `SelectionPlugin` instance for method chaining.

public SelectionPlugin<T> setRetainSelectionOnDataChange(boolean retainSelectionOnDataChange)
Sets whether to retain row selection on data changes in the DataTable.

retainSelectionOnDataChange

`true` to retain row selection, `false` otherwise.



Returns:

This `SelectionPlugin` instance for method chaining.

public void onRowAdded(DataTable<T> dataTable, TableRow<T> tableRow)
Handles the addition of a row to the DataTable. If selection retention is enabled and the row was previously selected, it re-selects the row.

dataTable

The DataTable to which this plugin is applied.

tableRow

The row to be added.

public void handleEvent(DominoEvent event)
Handles DataTable events, specifically retaining the selection on data change events.

event

The DataTable event.

public SelectionPlugin<T> setCheckBoxCreator(CheckBoxCreator<T> checkBoxCreator)
Sets a custom CheckBox creator for multi-selection cells.

checkBoxCreator

A custom CheckBox creator.



Returns:

This `SelectionPlugin` instance for method chaining.

We are a group of passionate people who love what we do

Donate & Support Us