From aa308d7d06eed511eb956c2e58c07ac8a93b0106 Mon Sep 17 00:00:00 2001 From: C?dric Krier Date: Sat, 5 Mar 2016 17:20:08 +0100 Subject: [PATCH] next_column returns only editable column index If we don't find any column, we should not return the last tested column because it is not a valid column. issue5284 review20801002 --- src/view/tree.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/view/tree.js b/src/view/tree.js index 7555d3a..d56a167 100644 --- a/src/view/tree.js +++ b/src/view/tree.js @@ -488,16 +488,18 @@ if (row) { column = row.next_column(null, new_); - td = row._get_column_td(column); - if (this.editable) { - td.triggerHandler('click'); - if (new_) { + if (column !== null) { + td = row._get_column_td(column); + if (this.editable) { td.triggerHandler('click'); + if (new_) { + td.triggerHandler('click'); + } else { + td.find(':input,[tabindex=0]').focus(); + } } else { td.find(':input,[tabindex=0]').focus(); } - } else { - td.find(':input,[tabindex=0]').focus(); } } } @@ -888,10 +890,9 @@ readonly = false; } if (!(invisible || readonly)) { - break; + return column_index; } } - return column_index; } }); @@ -1049,13 +1050,15 @@ } event_.preventDefault(); next_idx = this.next_column(this.edited_column, true, sign); - window.setTimeout(function() { - var td = this._get_column_td(next_idx); - td.triggerHandler('click', { - column: next_idx, - td: td - }); - }.bind(this), 0); + if (next_idx !== null) { + window.setTimeout(function() { + var td = this._get_column_td(next_idx); + td.triggerHandler('click', { + column: next_idx, + td: td + }); + }.bind(this), 0); + } } else if (event_.which == Sao.common.UP_KEYCODE || event_.which == Sao.common.DOWN_KEYCODE) { if (event_.which == Sao.common.UP_KEYCODE) {