2
0
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:
dima 2014-02-12 14:14:35 +04:00
parent 702bc0e9c3
commit c14d49d0fa

View File

@ -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;
@ -633,6 +637,14 @@
}
},
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:
if (suggestions.length && typeof suggestions[0] === 'string') {