mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-22 12:55:12 +00:00
commit
8138252b4c
21
dist/jquery.autocomplete.js
vendored
21
dist/jquery.autocomplete.js
vendored
@ -95,6 +95,7 @@
|
|||||||
serviceUrl: null,
|
serviceUrl: null,
|
||||||
lookup: null,
|
lookup: null,
|
||||||
onSelect: null,
|
onSelect: null,
|
||||||
|
onHint: null,
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
minChars: 1,
|
minChars: 1,
|
||||||
maxHeight: 300,
|
maxHeight: 300,
|
||||||
@ -632,7 +633,7 @@
|
|||||||
that.selectedIndex = -1;
|
that.selectedIndex = -1;
|
||||||
clearTimeout(that.onChangeTimeout);
|
clearTimeout(that.onChangeTimeout);
|
||||||
$(that.suggestionsContainer).hide();
|
$(that.suggestionsContainer).hide();
|
||||||
that.signalHint(null);
|
that.onHint(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
suggest: function () {
|
suggest: function () {
|
||||||
@ -768,19 +769,23 @@
|
|||||||
return !foundMatch;
|
return !foundMatch;
|
||||||
});
|
});
|
||||||
|
|
||||||
that.signalHint(bestMatch);
|
that.onHint(bestMatch);
|
||||||
},
|
},
|
||||||
|
|
||||||
signalHint: function (suggestion) {
|
onHint: function (suggestion) {
|
||||||
var hintValue = '',
|
var that = this,
|
||||||
that = this;
|
onHintCallback = that.options.onHint,
|
||||||
|
hintValue = '';
|
||||||
|
|
||||||
if (suggestion) {
|
if (suggestion) {
|
||||||
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
|
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
|
||||||
}
|
}
|
||||||
if (that.hintValue !== hintValue) {
|
if (that.hintValue !== hintValue) {
|
||||||
that.hintValue = hintValue;
|
that.hintValue = hintValue;
|
||||||
that.hint = suggestion;
|
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.el.val(that.getValue(that.suggestions[index].value));
|
||||||
}
|
}
|
||||||
|
|
||||||
that.signalHint(null);
|
that.onHint(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function (index) {
|
onSelect: function (index) {
|
||||||
@ -936,7 +941,7 @@
|
|||||||
that.el.val(that.currentValue);
|
that.el.val(that.currentValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
that.signalHint(null);
|
that.onHint(null);
|
||||||
that.suggestions = [];
|
that.suggestions = [];
|
||||||
that.selection = suggestion;
|
that.selection = suggestion;
|
||||||
|
|
||||||
|
2
dist/jquery.autocomplete.min.js
vendored
2
dist/jquery.autocomplete.min.js
vendored
File diff suppressed because one or more lines are too long
@ -46,7 +46,7 @@ $(selector).autocomplete(options);
|
|||||||
| Event setting | Function description |
|
| Event setting | Function description |
|
||||||
| :--- | :--- |
|
| :--- | :--- |
|
||||||
| `onSearchStart` | `function (params) {}` called before Ajax request. `this` is bound to input element |
|
| `onSearchStart` | `function (params) {}` called before Ajax request. `this` is bound to input element |
|
||||||
| `onHint` | `function (hint) {}` used to change input value to first suggestion automatically |
|
| `onHint` | `function (hint) {}` used to change input value to first suggestion automatically. `this` is bound to input element |
|
||||||
| `onSearchComplete` | `function (query, suggestions) {}` called after Ajax response is processed. `this` is bound to input element. `suggestions` is an array containing the results |
|
| `onSearchComplete` | `function (query, suggestions) {}` called after Ajax response is processed. `this` is bound to input element. `suggestions` is an array containing the results |
|
||||||
| `transformResult` | `function(response, originalQuery) {}` called after the result of the query is ready. Converts the result into response.suggestions format |
|
| `transformResult` | `function(response, originalQuery) {}` called after the result of the query is ready. Converts the result into response.suggestions format |
|
||||||
| `onSelect` | `function (suggestion) {}` Callback function invoked when user selects suggestion from the list. `this` inside callback refers to input HtmlElement.|
|
| `onSelect` | `function (suggestion) {}` Callback function invoked when user selects suggestion from the list. `this` inside callback refers to input HtmlElement.|
|
||||||
|
@ -95,6 +95,7 @@
|
|||||||
serviceUrl: null,
|
serviceUrl: null,
|
||||||
lookup: null,
|
lookup: null,
|
||||||
onSelect: null,
|
onSelect: null,
|
||||||
|
onHint: null,
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
minChars: 1,
|
minChars: 1,
|
||||||
maxHeight: 300,
|
maxHeight: 300,
|
||||||
@ -632,7 +633,7 @@
|
|||||||
that.selectedIndex = -1;
|
that.selectedIndex = -1;
|
||||||
clearTimeout(that.onChangeTimeout);
|
clearTimeout(that.onChangeTimeout);
|
||||||
$(that.suggestionsContainer).hide();
|
$(that.suggestionsContainer).hide();
|
||||||
that.signalHint(null);
|
that.onHint(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
suggest: function () {
|
suggest: function () {
|
||||||
@ -768,19 +769,23 @@
|
|||||||
return !foundMatch;
|
return !foundMatch;
|
||||||
});
|
});
|
||||||
|
|
||||||
that.signalHint(bestMatch);
|
that.onHint(bestMatch);
|
||||||
},
|
},
|
||||||
|
|
||||||
signalHint: function (suggestion) {
|
onHint: function (suggestion) {
|
||||||
var hintValue = '',
|
var that = this,
|
||||||
that = this;
|
onHintCallback = that.options.onHint,
|
||||||
|
hintValue = '';
|
||||||
|
|
||||||
if (suggestion) {
|
if (suggestion) {
|
||||||
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
|
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
|
||||||
}
|
}
|
||||||
if (that.hintValue !== hintValue) {
|
if (that.hintValue !== hintValue) {
|
||||||
that.hintValue = hintValue;
|
that.hintValue = hintValue;
|
||||||
that.hint = suggestion;
|
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.el.val(that.getValue(that.suggestions[index].value));
|
||||||
}
|
}
|
||||||
|
|
||||||
that.signalHint(null);
|
that.onHint(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function (index) {
|
onSelect: function (index) {
|
||||||
@ -936,7 +941,7 @@
|
|||||||
that.el.val(that.currentValue);
|
that.el.val(that.currentValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
that.signalHint(null);
|
that.onHint(null);
|
||||||
that.suggestions = [];
|
that.suggestions = [];
|
||||||
that.selection = suggestion;
|
that.selection = suggestion;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user