select.selector()

Since: Select 1.0.0

Get / set the item selector for mouse event capture. Please note - this property requires the Select extension for DataTables.

Description

Select has the ability to restrict which cells in the table will trigger item selection (be it row, column or cell selection). By default (select.selector) all cells can be used to select items, but this method provides the ability to modify that through the use of jQuery selectors.

This can be useful if you wish to ensure that only certain items in the table can be used to trigger selection - for example checkboxes in the first column, or to ignore action links in the last column.

Types

function select.selector()

Description:

Get the current item selector string applied to the table.

Returns:

Get the item selector string being used for the table.

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

function select.selector( set )

Description:

Set the table's item selector string. Note that any old selectors will be automatically removed if this is used as a selector to ensure that there are no memory leaks in unattached event listeners.

Parameters:
Returns:

DataTables API instance for chaining.

Example

Allow selection on the first column only:

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

table.select.selector( 'td:first-child' );

Related

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