select-blur
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:
Name Type Optional 1 e
No jQuery event object
2 dt
No DataTables API instance
3 target
No The element that was clicked on to activate this event.
4 originalEvent
No The original event that triggered this event.
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.