mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-09 14:50:57 +00:00
Updated onHint
This commit is contained in:
parent
75fd1b391d
commit
a4d35398cc
@ -95,6 +95,7 @@
|
||||
serviceUrl: null,
|
||||
lookup: null,
|
||||
onSelect: null,
|
||||
onHint: null,
|
||||
width: 'auto',
|
||||
minChars: 1,
|
||||
maxHeight: 300,
|
||||
@ -632,7 +633,7 @@
|
||||
that.selectedIndex = -1;
|
||||
clearTimeout(that.onChangeTimeout);
|
||||
$(that.suggestionsContainer).hide();
|
||||
that.signalHint(null);
|
||||
that.onHint(null);
|
||||
},
|
||||
|
||||
suggest: function () {
|
||||
@ -768,19 +769,23 @@
|
||||
return !foundMatch;
|
||||
});
|
||||
|
||||
that.signalHint(bestMatch);
|
||||
that.onHint(bestMatch);
|
||||
},
|
||||
|
||||
signalHint: function (suggestion) {
|
||||
var hintValue = '',
|
||||
that = this;
|
||||
onHint: function (suggestion) {
|
||||
var that = this,
|
||||
onHintCallback = that.options.onHint,
|
||||
hintValue = '';
|
||||
|
||||
if (suggestion) {
|
||||
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
|
||||
}
|
||||
if (that.hintValue !== hintValue) {
|
||||
that.hintValue = hintValue;
|
||||
that.hint = suggestion;
|
||||
(this.options.onHint || $.noop)(hintValue);
|
||||
if ($.isFunction(onHintCallback)) {
|
||||
onHintCallback.call(that.element, hintValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -922,7 +927,7 @@
|
||||
that.el.val(that.getValue(that.suggestions[index].value));
|
||||
}
|
||||
|
||||
that.signalHint(null);
|
||||
that.onHint(null);
|
||||
},
|
||||
|
||||
onSelect: function (index) {
|
||||
@ -936,7 +941,7 @@
|
||||
that.el.val(that.currentValue);
|
||||
}
|
||||
|
||||
that.signalHint(null);
|
||||
that.onHint(null);
|
||||
that.suggestions = [];
|
||||
that.selection = suggestion;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user