{hero}

deselect

Since: Select 1.0.0

Items (rows, columns or cells) have been deselected.
Please note - this property requires the Select extension for DataTables.

Description

This event is triggered whenever items (rows, columns or cells) are deselected in a DataTable, and provides information about which item(s) have been deselected.

Please note that for performance reasons only a single event is triggered for each deselection action. The result is that if multiple items are deselected in a single action, each item deselected does not receive its own event, but rather the information about the deselected items is conveyed in an array.

Additionally, as with all DataTables emitted events, this event is triggered with the dt namespace. As such, to listen for this event, you must also use the dt namespace by simply appending .dt to your event name (this is done automatically when using on() and one()).

Type

function function( e, dt, type, indexes )

Parameters:

Examples

Get data from rows whenever rows are deselected:

var table = new DataTable('#myTable');

table.on('deselect', function (e, dt, type, indexes) {
	if (type === 'row') {
		var data = table
			.rows(indexes)
			.data()
			.pluck('id');

		// do something with the ID of the deselected items
	}
});

Remove a custom class when an item is deselected:

var table = new DataTable('#myTable');

table.on('deselect', function (e, dt, type, indexes) {
	table[type](indexes)
		.nodes()
		.to$()
		.removeClass('custom-selected');
});