keys.focus
Cell to receive initial focus in the table.
Please note - this property requires the KeyTable extension for DataTables.
Description
This option can be used to define what cell in the table (if any) will automatically receive focus when the table is initialised with KeyTable enabled.
The value of this option will be over-ridden if state saving is enabled in DataTables (stateSave
) and there is a saved focused cell - i.e. the state saved focused cell will instead receive the focus.
Type
cell-selector
- Description:
The cell that will receive focus when the table is initialised. This accepts all of the options of
cell-selector
such as class name selector, jQuery pseudo selects and cell index selectors.
Default
- Value:
null
The table will not automatically receive focus when initialised
Example
Automatically focus on the first cell in the table:
new DataTable('#myTable', {
keys: {
focus: ':eq(0)'
}
});
Related
The following options are directly related and may also be useful in your application development.