Usage
Initialisation and configuration of KeyTable is performed through the keyTable initialisation option for DataTables. This option can be given as a simple boolean value to enable KeyTable with its default values, or as an object to provide more granular control.
Simple initialisation
In its most simple case, you can enable KeyTable by simply setting keyTable: true as an option in the DataTables initialisation:
new DataTable('#myTable', {
keyTable: true
});
If you do this, you may wish to use the key event (and friends) to know when the end user has completed an action with KeyTable, so other actions can be used.
Options
For more complex cases, the keyTable option can be used as an object allowing you to specify specific columns, pre-set column order, etc. In the following case, keyTable.columns is used to allow keyboard movement on all columns except the first and last column in the table, and keyTable.editor is used to provide inline editing ability.
new DataTable('#myTable', {
keyTable: {
columns: ':not(:first-child, :last-child)',
editor: myEditorInstance
}
});
Reference
For a complete list of the options that KeyTable supports, please refer to the DataTables initialisation options reference. The KeyTable examples also demonstrate the options available.