cell().focus()

Since: KeyTable 2.0.0

Focus on a cell. Please note - this property requires the KeyTable extension for DataTables.

Description

This method provides the ability to programmatically give a cell focus. The cell to give focus to is selected by the cell() method and the cell-selector given to it.

If the selected cell is not in the DataTable's current page, the paging will be adjusted to make it visible and the table redraw.

Tables which are disabled (keys.disable()) cannot have cells focused. You must either give the cell focus before disabling, or re-enable the table (keys.enable()) to allow focusing, even via the API.

If a different cell has focus when this method is called, it will cause that cell to be blurred before this one is selected.

Type

function cell().focus()

Description:

Focus on the selected cell.

Returns:

DataTables API instance

Example

Focus on the first cell in the table:

table.cell( ':eq(0)' ).focus();

Related

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