Skip to content

Commit 8927968

Browse files
committed
mouse clicking in autosuggest moved selection 2 fields down
1 parent d706690 commit 8927968

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

jquery.handsontable.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,12 @@
551551
}, 100);
552552
}
553553

554+
var currentValue;
555+
556+
function onKeyUp(event) {
557+
currentValue = priv.editProxy.val();
558+
}
559+
554560
function onKeyDown(event) {
555561
if (selection.isSelected()) {
556562
if ((event.keyCode >= 48 && event.keyCode <= 57) || //0-9
@@ -667,18 +673,20 @@
667673
}
668674

669675
function onChange(event) {
670-
if(isAutoComplete()) {
671-
priv.isCellEdited = true;
672-
editproxy.finishEditing(event); //hide edit field
673-
selection.transformStart(1, 0); //move selection down
674-
//editproxy.prepare(priv.selStart); //hide edit field
676+
if(currentValue !== priv.editProxy.val()) { //do we really have an outside change
677+
if(isAutoComplete()) { //could this change be from autocomplete
678+
priv.isCellEdited = true;
679+
editproxy.finishEditing(event); //save change, hide edit field
680+
selection.transformStart(1, 0); //move selection down
681+
}
675682
}
676683
}
677684

678685
priv.editProxy.bind('click', onClick);
679686
priv.editProxy.bind('dblclick', onDblClick);
680687
priv.editProxy.bind('cut', onCut);
681688
priv.editProxy.bind('paste', onPaste);
689+
priv.editProxy.bind('keyup', onKeyUp);
682690
priv.editProxy.bind('keydown', onKeyDown);
683691
priv.editProxy.bind('change', onChange);
684692
container.append(priv.editProxy);

0 commit comments

Comments
 (0)