mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-09 23:01:00 +00:00
issue #451, put formatGroup available in option
This commit is contained in:
parent
3b49827db4
commit
937574fa0d
@ -67,6 +67,7 @@
|
||||
deferRequestBy: 0,
|
||||
params: {},
|
||||
formatResult: Autocomplete.formatResult,
|
||||
formatGroup: Autocomplete.formatGroup,
|
||||
delimiter: null,
|
||||
zIndex: 9999,
|
||||
type: 'GET',
|
||||
@ -143,6 +144,18 @@
|
||||
.replace(/<(\/?strong)>/g, '<$1>');
|
||||
};
|
||||
|
||||
Autocomplete.formatGroup = function (suggestion, index) {
|
||||
var currentCategory = suggestion.data[groupBy];
|
||||
|
||||
if (category === currentCategory){
|
||||
return '';
|
||||
}
|
||||
|
||||
category = currentCategory;
|
||||
|
||||
return '<div class="autocomplete-group"><strong>' + category + '</strong></div>';
|
||||
};
|
||||
|
||||
Autocomplete.prototype = {
|
||||
|
||||
killerFn: null,
|
||||
@ -657,17 +670,7 @@
|
||||
beforeRender = options.beforeRender,
|
||||
html = '',
|
||||
category,
|
||||
formatGroup = function (suggestion, index) {
|
||||
var currentCategory = suggestion.data[groupBy];
|
||||
|
||||
if (category === currentCategory){
|
||||
return '';
|
||||
}
|
||||
|
||||
category = currentCategory;
|
||||
|
||||
return '<div class="autocomplete-group"><strong>' + category + '</strong></div>';
|
||||
};
|
||||
formatGroup = options.formatGroup;
|
||||
|
||||
if (options.triggerSelectOnValidInput && that.isExactMatch(value)) {
|
||||
that.select(0);
|
||||
|
Loading…
Reference in New Issue
Block a user