From 64b2fc0b13a1c78c08bf63043b5b5c0163c3ae5b Mon Sep 17 00:00:00 2001 From: mleibman Date: Tue, 18 May 2010 14:06:33 -0700 Subject: [PATCH] FIXED: Issue 25 - Can't use left & right arrow keys in cell editors Sample text cell editors now control which keys should not be propagated. --- slick.editors.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/slick.editors.js b/slick.editors.js index eb03eeba3..4adbb9d2a 100644 --- a/slick.editors.js +++ b/slick.editors.js @@ -78,6 +78,13 @@ var SlickEditor = { } $input.appendTo($container); + + $input.bind("keydown.nav", function(e) { + if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) { + e.stopImmediatePropagation(); + } + }); + $input.focus().select(); }; @@ -133,6 +140,12 @@ var SlickEditor = { $input.val(defaultValue); } + $input.bind("keydown.nav", function(e) { + if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) { + e.stopImmediatePropagation(); + } + }); + $input.appendTo($container); $input.focus().select(); }; @@ -176,7 +189,6 @@ var SlickEditor = { this.init(); }, - DateCellEditor : function($container, columnDef, value, dataContext) { var $input; var defaultValue = value; @@ -434,6 +446,11 @@ var SlickEditor = { $input.val(defaultValue); } + $input.bind("keydown.nav", function(e) { + if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) { + e.stopImmediatePropagation(); + } + }); $input.appendTo($container); $input.focus().select(); }; @@ -500,6 +517,11 @@ var SlickEditor = { $input.val(defaultValue.join(", ")); } + $input.bind("keydown.nav", function(e) { + if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) { + e.stopImmediatePropagation(); + } + }); $input.appendTo($container); $input.focus().select(); };