select.style()

Since: Select 1.0.0

Get / set the style by which the end user can select items in the table. Please note - this property requires the Select extension for DataTables.

Description

Select has four different modes of operation for end user selection of items in the table:

  • api - Selection can only be performed via the API - this means that selection is disabled unless you use 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.

Each of these options can be used with the three table items that can be selected (select.items()).

Types

function select.style()

Description:

Get the current selection style applied to the table.

Returns:

The current selection style, this will be one of api, single, multi or os.

Note that if multiple tables are defined in the API's context, only the selection style of the first table will be returned.

function select.style( set )

Description:

Set the table's selection style.

Parameters:
Returns:

DataTables API instance for chaining.

Example

Let the user select items using the os selection style:

var table = $('#myTable').DataTable();

table.select.style( 'os' );

Related

The following options are directly related and may also be useful in your application development.