key-refocus
KeyTable has refocused a cell.
Please note - this property requires the KeyTable extension for DataTables.
Description
The key-focus
event can be used to determine when a cell has been focused on, but will not be triggered again if a cell is clicked upon when it already has focus. While this is done to present unnecessary processing, there may be occasions where this information is useful.
To that end, this event behaves exactly like key-focus
, but will only be triggered when a cell which already has focus is focused on again (either by a click event, or API action).
Type
function( e, datatable, cell, originalEvent )
Parameters:
Name | Type | Optional | |
---|---|---|---|
1 | e | No | |
jQuery event object | |||
2 | datatable | No | |
DataTable API instance for the table in question | |||
3 | cell | No | |
A DataTables API instance that contains the cell that was focused ( | |||
4 | originalEvent | No | |
The original event that triggered this focus. It may be:
|
Example
Show information about a cell when focus is activated, including reclicking on an already focused cell:
var table = new DataTable('#myTable', {
keys: true
});
table
.on('key-focus key-refocus', function (e, datatable, cell, originalEvent) {
var rowData = datatable.row(cell.index().row).data();
$('#details').html('Cell in ' + rowData[0] + ' focused');
})
.on('key-blur', function (e, datatable, cell) {
$('#details').html('No cell selected');
});
Related
The following options are directly related and may also be useful in your application development.