Beta Release - This version is currently under development and should not be used in a production environment.

Key Bindings

Overview

The keybidings module alows you to bind different keyboard shortcuts to actions on your table, as long as it has foucs.

This is enabled by default to allow you to navigate around cells when editing and scroll up and down your table using arrow keys and pageup/pagedown keys

Default Key Bindings

By defualt the following actions are bound to the listed key combinations:

Action Default Key Combination (keycode) Function
navPrev ctrl + tab ("ctrl + 9") Shift focus to the next editable cell on the left, if none available move to the right most editable cell on the row above
navNext tab ("9") Shift focus to the next editable cell on the right, if none available move to left most editable cell on the row below
navLeft Shift focus to next editable cell on the left
navRight Shift focus to next editable cell on the right
navUp up arrow ("38") Shift focus to the same cell in the row above
navDown down arrow ("40") Shift focus to the same cell in the row below
undo ctrl + z ("ctrl + 90") Undo last user data edit
redo ctrl + y ("ctrl + 89") Redo last user data edit
scrollPageUp Page Up ("33") scroll page up by table height
scrollPageDown Page Down ("34") scroll page down by table height
scrollToStart Home ("36") scroll to first row
scrollToEnd End ("35") scroll to last row
copyToClipboard ctrl + c ("ctrl + 67") copy table data to clipboard

Customize Key Bindings

If you would prefer to use different key combinations then that is no problem, you can use the keybindings option to change any of the above bindings.

The keybindings option takes an object that should consist of properties with the name of the action you wish to bind and a value of the key code string.

The key code should consist of the keycodes for the keys to be pressed, seperated by the + symbol. The exceptions to this are ctrl and shift which should be used to check that the ctrl or shift keys are pressed as well.

The example below shows how to change the key bindings for the redo function to user the ctrl and r keys:

var table = new Tabulator("#example-table", {
    keybindings:{
        "redo" : "ctrl + 82", //bind redo function to ctrl + r
    },
});

Disable A Default Key Binding

To disable any of the default keybindings, pass a value of false to is property in the keybindings option:

var table = new Tabulator("#example-table", {
    keybindings:{
        "navUp" : false, //disable navUp keybinding
    },
});

Disable All Key Bindings

To disable all key bindings set the keybindings option to false

var table = new Tabulator("#example-table", {
    keybindings:false, //disable all key bindings
});