2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-12-23 11:28:53 +00:00

Merge pull request #42 from nilsga/master

Fix for issue #40
This commit is contained in:
Tomas Kirda 2013-02-08 11:47:42 -08:00
commit a64be996a8

View File

@ -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);
} }