Posts Tagged ‘keyboard’

KeyTable: Instant keyboard navigation in a table

March 18th, 2009 No comments

Allan Jardine is up to his old tricks again (his tricks are: creating helpful small tools!). This time he has created KeyTable, a library that adds the ability to use the keyboard to navigate around an HTML table.

Events can be bound (and unbound) to cells as required by the developer, allowing increased accessibility to Javascript enhanced tables. This library is somewhat similar to QFocuser that was posted on Ajaxian back at the start of the month, but specialises in table navigation. KeyTable also integrates nicely with DataTables, such that paging and sorting is taken into account.

To get started you just need to var keys = new KeyTable(); and then you can add init params for fine grained work, and you can also add events:



  1. /* Example event listener */

  2. keys.event.focus( 1, 3, function() {

  3. /* processing on cell 1,3 … */

  4. } ); 

  5. /* this is exactly the same as */

  6. keys.event.focus( $(‘#example tbody tr:eq(3) td:eq(1)’)[0], function() {

  7. /* processing on cell 1,3 … */

  8. } );

The front page has an example that uses jEditable allowing you to mouse around, hit enter, change a field, and go back: