selectedSingle

Since: Select 1.0.0

Button that is enabled when a single item is selected in the table. Please note - this property requires the Select extension for DataTables.

Description

This button is very similar to the selected button type, but in this case rather than being enabled for one or more items selected in the table, it is enabled when there is a single item only selected.

Single item selection can be useful when you wish to perform complex actions on an item, such as editing the data in a row.

By providing an action function (buttons.buttons.action / button().action()) this button can be used to perform whatever operation is required on the table and its selected item.

Example

DataTables initialisation: Log the data for the selected row:

$('#myTable').DataTable( {
	buttons: [
		{
			extend: 'selectedSingle',
			text: 'Log selected data',
			action: function ( e, dt, button, config ) {
				console.log( dt.row( { selected: true } ).data() );
			}
		}
	]
} );