diff options
Diffstat (limited to 'slick.grid.js')
-rw-r--r-- | slick.grid.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/slick.grid.js b/slick.grid.js index 3f41c34..a49e5e4 100644 --- a/slick.grid.js +++ b/slick.grid.js @@ -114,7 +114,7 @@ if (typeof Slick === "undefined") { var $container; var uid = "slickgrid_" + Math.round(1000000 * Math.random()); var self = this; - var $focusSink; + var $focusSink, $focusSink2; var $headerScroller; var $headers; var $headerRow, $headerRowScroller, $headerRowSpacer; @@ -133,6 +133,7 @@ if (typeof Slick === "undefined") { var absoluteColumnMinWidth; var numberOfRows = 0; + var tabbingDirection = 1; var activePosX; var activeRow, activeCell; var activeCellNode = null; @@ -254,6 +255,8 @@ if (typeof Slick === "undefined") { $canvas = $("<div class='grid-canvas' />").appendTo($viewport); + $focusSink2 = $focusSink.clone().appendTo($container); + if (!options.explicitInitialization) { finishInitialization(); } @@ -302,7 +305,7 @@ if (typeof Slick === "undefined") { .delegate(".slick-header-column", "mouseleave", handleHeaderMouseLeave); $headerRowScroller .bind("scroll", handleHeaderRowScroll); - $focusSink + $focusSink.add($focusSink2) .bind("keydown", handleKeyDown); $canvas .bind("keydown", handleKeyDown) @@ -2363,7 +2366,11 @@ if (typeof Slick === "undefined") { } function setFocus() { - $focusSink[0].focus(); + if (tabbingDirection == -1) { + $focusSink[0].focus(); + } else { + $focusSink2[0].focus(); + } } function scrollCellIntoView(row, cell) { @@ -2901,6 +2908,16 @@ if (typeof Slick === "undefined") { } setFocus(); + var tabbingDirections = { + "up": -1, + "down": 1, + "left": -1, + "right": 1, + "prev": -1, + "next": 1 + }; + tabbingDirection = tabbingDirections[dir]; + var stepFunctions = { "up": gotoUp, "down": gotoDown, |