mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2025-01-25 16:18:30 +00:00
Issue #40 - Only ignore value change when selection is made by pressing the enter key
This commit is contained in:
parent
56195317c8
commit
83108c1f14
@ -179,7 +179,7 @@
|
|||||||
|
|
||||||
// Listen for click event on suggestions list:
|
// Listen for click event on suggestions list:
|
||||||
container.on('click', suggestionSelector, function () {
|
container.on('click', suggestionSelector, function () {
|
||||||
that.select($(this).data('index'));
|
that.select($(this).data('index'), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
that.fixPosition();
|
that.fixPosition();
|
||||||
@ -297,7 +297,7 @@
|
|||||||
that.hide();
|
that.hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
that.select(that.selectedIndex);
|
that.select(that.selectedIndex, e.keyCode === keys.RETURN);
|
||||||
if (e.keyCode === keys.TAB && this.options.tabDisabled === false) {
|
if (e.keyCode === keys.TAB && this.options.tabDisabled === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -515,13 +515,13 @@
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
select: function (i) {
|
select: function (i, shouldIgnoreNextValueChange) {
|
||||||
var that = this,
|
var that = this,
|
||||||
selectedValue = that.suggestions[i];
|
selectedValue = that.suggestions[i];
|
||||||
|
|
||||||
if (selectedValue) {
|
if (selectedValue) {
|
||||||
that.el.val(selectedValue);
|
that.el.val(selectedValue);
|
||||||
that.ignoreValueChange = true;
|
that.ignoreValueChange = shouldIgnoreNextValueChange;
|
||||||
that.hide();
|
that.hide();
|
||||||
that.onSelect(i);
|
that.onSelect(i);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user