{hero}

keys.columns

Since: KeyTable 2.0.0

Select the columns that can gain focus.
Please note - this property requires the KeyTable extension for DataTables.

Description

When working with complex tables it is not uncommon to have certain columns that you might not wish to allow spreadsheet like navigation on (for example a checkbox column for row selection or a column with editing action buttons). This option can be used to define which columns can receive focus. If a column cannot receive focus KeyTable will skip over it as if it was not present.

Please note that only visible cells can receive focus, so the columns defined by this option are automatically merged with the visible columns in the table. Non-visible columns will not receive focus.

Type

column-selector

Description:

The columns that can gain focus. This accepts all of the options of column-selector such as class name selector, jQuery pseudo selects and column index selectors.

Default

  • Value:

Empty string (i.e. all columns)

Examples

Don't allow focus on the last column in the table:

new DataTable('#myTable', {
	keys: {
		columns: ':not(:last-child)'
	}
});

Allow focus only on column indexes 1, 2, 3, 4:

new DataTable('#myTable', {
	keys: {
		columns: [1, 2, 3, 4]
	}
});