{hero}

select-blur

Since: Select 1.4.0

Prior to blurring item selection in the DataTable (cancellable).
Please note - this property requires the Select extension for DataTables.

Description

The select.blurable option can be used to have Select automatically remove row selection from the table when set, however, there are times when you might wish to retain focus depending on where the click landed on the page (e.g. inside a model). This event provides that ability. You can call .preventDefault() on the event object to stop the table from being blurred.

Type

function function( e, dt, target, originalEvent )

Parameters:

Example

Don't blur if the click was inside a Bootstrap modal:

var table = new DataTable('#myTable', {
	select: {
		blurable: true,
		style: 'os'
	}
});

table.on('select-blur', function (e, dt, target, originalEvent) {
	if ($(e.target).parents('div.modal').length) {
		e.preventDefault();
	}
});

Related

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