Login Register

onkeydown

Navigating through cells with keyboard

Hello everyone,

I've created a grid with cells that can be edited.
I now want to add the ability to move from one cell to another using the keys UP, DOWN, LEFT and RIGHT

So I did this to catch the keyboard events :

dojo.connect(this.grid, 'onKeyDown', this, this._keyDown);

And for the _keyDown function :


_keyDown: function (e) {

switch (e.keyCode) {
case dojo.keys.UP_ARROW:
var selectedRow = parseInt(this.grid.selection.getSelected()[0]);

var nextRow = selectedRow - 1;
if (selectedRow > 0 && this.grid.edit.info.cell != null) {

Syndicate content