mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-29 08:14:06 +00:00
Added presentation settings for showing category and suggestion while hovering over appropriate divs (by embedding them in title attributes).
This commit is contained in:
parent
95a329d80d
commit
af8560d12d
@ -62,6 +62,8 @@ The standard jquery.autocomplete.js file is around 13KB when minified.
|
||||
* `preserveInput`: if `true`, input value stays the same when navigating over suggestions. Default: `false`.
|
||||
* `showNoSuggestionNotice`: Default `false`. When no matching results, display a notification label.
|
||||
* `noSuggestionNotice`: Default `No results`. Text or htmlString or Element or jQuery object for no matching results label.
|
||||
* `showCategoryOnHover`: Default `false`. Embeds category in title attribute for each autocomplete-group div.
|
||||
* `showSuggestionOnHover`: Default `false`. Embeds suggestion in title attribute for each autocomplete-suggestion div.
|
||||
* `onInvalidateSelection`: `function () {}` called when input is altered after selection has been made. `this` is bound to input element.
|
||||
* `tabDisabled`: Default `false`. Set to true to leave the cursor in the input field after the user tabs to select a suggestion.
|
||||
|
||||
|
@ -90,6 +90,8 @@
|
||||
},
|
||||
showNoSuggestionNotice: false,
|
||||
noSuggestionNotice: 'No results',
|
||||
showCategoryOnHover: false,
|
||||
showSuggestionOnHover: false,
|
||||
orientation: 'bottom',
|
||||
forceFixPosition: false
|
||||
};
|
||||
@ -666,7 +668,11 @@
|
||||
|
||||
category = currentCategory;
|
||||
|
||||
return '<div class="autocomplete-group"><strong>' + category + '</strong></div>';
|
||||
if (options.showCategoryOnHover) {
|
||||
return '<div class="autocomplete-group" title="' + category + '"><strong>' + category + '</strong></div>';
|
||||
} else {
|
||||
return '<div class="autocomplete-group"' + '><strong>' + category + '</strong></div>';
|
||||
}
|
||||
};
|
||||
|
||||
if (options.triggerSelectOnValidInput && that.isExactMatch(value)) {
|
||||
@ -680,7 +686,11 @@
|
||||
html += formatGroup(suggestion, value, i);
|
||||
}
|
||||
|
||||
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>';
|
||||
if (options.showSuggestionOnHover) {
|
||||
html += '<div class="' + className + '" data-index="' + i + '" title="' + suggestion.value + '">' + formatResult(suggestion, value, i) + '</div>';
|
||||
} else {
|
||||
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>';
|
||||
}
|
||||
});
|
||||
|
||||
this.adjustContainerWidth();
|
||||
|
Loading…
Reference in New Issue
Block a user