table-select
Allows you to select table row elements like in your standard finder environment.
Built in support control
, shift
, enter
and the arrow keys.
Quick Start
Browser Support
table-select
expects classList
to be supported. For this to work on older versions of
IE, use a shim.
Additional options
You can pass in options as a second parameter. The currently supported options are:
className
: The class name of the table. Default:'selectable'
.tabIndex
: The tab index of the table. Default: `1.selectedClassName
: The class name of a selected row. Default:'selected'
.shouldSelectRow(row)
: Function that determines whetherrow
is selectable. Default: All rows can be selected.shouldDeselectRow(row)
: Function that determines whetherrow
is deselectable. Default: All rows can be deselected.
document selectedClassName: 'highlighted' { return !rowclassList; };
You can configure the default options by setting them via:
; ;
Events
table-select
supports five custom events:
beforeSelect
afterSelect
beforeDeselect
afterDeselect
action
Specifc information of the event can be found in event.detail
, e.g.:
var table = document;var tableSelect = table; table; table;
Node
// npm install table-select; const tableSelect = element options;
Contributing
If you would like to submit a pull request
with any changes you make, please feel free!
Simply run npm test
to test and npm start
to compile before submitting pull requests.
Issues
Please use the GitHub issue tracker to raise any problems or feature requests.