{hero}

row().focus()

Since: Select 3.0.0

Move keyboard focus to a specific row.
Please note - this property requires the Select extension for DataTables.

Description

When select.keys is enabled rows in the table can gain focus to allow keyboard navigation. This method provides the ability to programmatically set which row in the table should gain focus. It does not do automatic page shifting - make sure the row you want to focus on is shown in the current page!

Note that this method only has an effect when select.keys is enabled. If that option is disabled (or has been disabled via select.keys()) this method will do nothing. It also will not throw an error - it is just a no operation action.

Type

row().focus()

Move keyboard focus to the row selected.

Returns:

DataTables.Api API instance that contains a reference to the selected row.

Example

Focus on the first row in the table's current page:

var table = new DataTable('#myTable');

table.row(':first-child', {page: 'current'}).focus();

Related

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