From c1da188a174abf3f326c4e03a637fcdbf558788e Mon Sep 17 00:00:00 2001 From: hydrogen2oxygen Date: Mon, 15 Aug 2016 14:20:44 +0200 Subject: [PATCH] Navigation with TAB should now work When the focused cell reached the end of the row, the active.next('td').length returns 0. By this trigger you can select the next row and the first column with this call: active.closest('tr').next().find('td:first-child').focus().click(); --- mindmup-editabletable.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mindmup-editabletable.js b/mindmup-editabletable.js index 36be540..6a9e600 100644 --- a/mindmup-editabletable.js +++ b/mindmup-editabletable.js @@ -70,8 +70,15 @@ $.fn.editableTableWidget = function (options) { editor.hide(); active.focus(); } else if (e.which === TAB) { - active.focus(); - } else if (this.selectionEnd - this.selectionStart === this.value.length) { + e.preventDefault(); + e.stopPropagation(); + + if (active.next('td').length == 0) { + active.closest('tr').next().find('td:first-child').focus().click(); + } else { + active.next('td').focus().click(); + } + } else if (this.selectionEnd - this.selectionStart === this.value.length) { var possibleMove = movement(active, e.which); if (possibleMove.length > 0) { possibleMove.focus();