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.
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 (
Get the current selection style applied to the table.
The current selection style, this will be one of
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 )
Set the table's selection style.
Name Type Optional 1
Selection style to set - this must be one of
DataTables API instance for chaining.
Let the user select items using the os selection style:
var table = $('#myTable').DataTable(); table.select.style( 'os' );
The following options are directly related and may also be useful in your application development.