mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-22 12:55:12 +00:00
onSearchHasZeroRows and onSearchHasRows callback processing
This commit is contained in:
parent
702bc0e9c3
commit
c14d49d0fa
@ -70,6 +70,8 @@
|
||||
noCache: false,
|
||||
onSearchStart: noop,
|
||||
onSearchComplete: noop,
|
||||
onSearchHasZeroRows: noop,
|
||||
onSearchHasRows: noop,
|
||||
onSearchError: noop,
|
||||
containerClass: 'autocomplete-suggestions',
|
||||
tabDisabled: false,
|
||||
@ -543,6 +545,8 @@
|
||||
},
|
||||
|
||||
suggest: function () {
|
||||
this.beforeSuggest();
|
||||
|
||||
if (this.suggestions.length === 0) {
|
||||
this.hide();
|
||||
return;
|
||||
@ -632,6 +636,14 @@
|
||||
(this.options.onHint || $.noop)(hintValue);
|
||||
}
|
||||
},
|
||||
|
||||
beforeSuggest: function() {
|
||||
if (this.suggestions.length === 0) {
|
||||
this.options.onSearchHasZeroRows.call();
|
||||
} else {
|
||||
this.options.onSearchHasRows.call();
|
||||
}
|
||||
},
|
||||
|
||||
verifySuggestionsFormat: function (suggestions) {
|
||||
// If suggestions is string array, convert them to supported format:
|
||||
|
Loading…
Reference in New Issue
Block a user