{hero}

select.style

Since: Select 1.0.0

Set the selection style for end user interaction with the table.
Please note - this property requires the Select extension for DataTables.

Description

Select provides a number of different built in ways that an end user can interact with the selection of items in the table, which is controlled by this parameter (and select.style() after initialisation).

The default mode of operation is based on the selection of files in modern operating systems where the ctrl/cmd and shift keys can be used to provide complex operations.

Note that while the api option disables item selection via Select's built in event handler, it is quite possible to use the API to still provide the end user with the ability to select / deselect items based on your own event handlers.

Type

string

Description:

This option can take one of the following values:

  • api - Selection can only be performed via the API
  • single - Only a single item can be selected, any other selected items will be automatically deselected when a new item is selected
  • multi - Multiple items can be selected. Selection is performed by simply clicking on the items to be selected
  • os - Operating System (OS) style selection. This is the most comprehensive option and provides complex behaviours such as ctrl/cmd clicking to select / deselect individual items, shift clicking to select ranges and an unmodified click to select a single item.
  • multi+shift - a hybrid between the os style and multi, allowing easy multi-row selection without immediate de-selection when clicking on a row.

Default

  • Value: os

Examples

Disable end user selection via Select's click event handler:

new DataTable('#myTable', {
	select: {
		style: 'api'
	}
});

Enable selection with single item selection only:

new DataTable('#myTable', {
	select: {
		style: 'single'
	}
});