{hero}

select.selector

Since: Select 1.0.0

Set the element selector used for mouse event capture to select items.
Please note - this property requires the Select extension for DataTables.

Description

By default when item selection is active (select.style set to anything other than api), Select will select items based on any cell in the table when it is clicked. However, at times it can be useful to limit this selection to certain cells (based on column for example), which can be done through this option.

It is a simple jQuery selector string that is used to attach the event listeners that Select adds to the table.

Type

string

Description:

jQuery selector that will select the cells that can trigger item selection.

Default

  • Value: td, th

Examples

Allow selection on the first column only:

new DataTable('#myTable', {
	select: {
		style: 'os',
		selector: 'td:first-child',
		blurable: true
	}
});

Allow selection on all but the last column:

new DataTable('#myTable', {
	select: {
		style: 'os',
		selector: 'td:not(:last-child)'
	}
});

Related

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