{hero}

key-blur

Since: KeyTable 2.0.0

KeyTable has blurred focus from a cell.
Please note - this property requires the KeyTable extension for DataTables.

Description

While it is often useful to know when a cell gains focus (key-focus) it is equally useful to know when that cell loses focus. This event provides that ability and is triggered whenever a cell's focus is blurred. This can be the result of:

  • Focus moving to a different cell
  • Focus leaving the table (keys.blurable).

This event will occur prior to the key-focus event (if there is a cell to be blurred - i.e. two cells can never have focus at the same time). Additionally, if a DataTables page change is required to display a newly focused cell, this event will occur before the page change is triggered.

Type

function function( e, datatable, cell )

Parameters:

Example

Show information about a cell when focus is changed:

var table = $('#example').DataTable( {
	keys: true
} );

table
	.on( 'key-focus', function ( e, datatable, cell ) {
		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.