|
1 | 1 | /** |
2 | | -* Ajax Autocomplete for jQuery, version 1.2.27 |
3 | | -* (c) 2015 Tomas Kirda |
| 2 | +* Ajax Autocomplete for jQuery, version 1.3.0 |
| 3 | +* (c) 2017 Tomas Kirda |
4 | 4 | * |
5 | 5 | * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. |
6 | 6 | * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete |
|
67 | 67 | deferRequestBy: 0, |
68 | 68 | params: {}, |
69 | 69 | formatResult: Autocomplete.formatResult, |
| 70 | + formatGroup: Autocomplete.formatGroup, |
70 | 71 | delimiter: null, |
71 | 72 | zIndex: 9999, |
72 | 73 | type: 'GET', |
|
143 | 144 | .replace(/<(\/?strong)>/g, '<$1>'); |
144 | 145 | }; |
145 | 146 |
|
| 147 | + Autocomplete.formatGroup = function (suggestion, category) { |
| 148 | + return '<div class="autocomplete-group"><strong>' + category + '</strong></div>'; |
| 149 | + }; |
| 150 | + |
146 | 151 | Autocomplete.prototype = { |
147 | 152 |
|
148 | 153 | killerFn: null, |
|
671 | 676 |
|
672 | 677 | category = currentCategory; |
673 | 678 |
|
674 | | - return '<div class="autocomplete-group"><strong>' + category + '</strong></div>'; |
| 679 | + return options.formatGroup(suggestion, category); |
675 | 680 | }; |
676 | 681 |
|
677 | 682 | if (options.triggerSelectOnValidInput && that.isExactMatch(value)) { |
|
742 | 747 | if (options.width === 'auto') { |
743 | 748 | width = that.el.outerWidth(); |
744 | 749 | container.css('width', width > 0 ? width : 300); |
| 750 | + } else if(options.width === 'flex') { |
| 751 | + // Trust the source! Unset the width property so it will be the max length |
| 752 | + // the containing elements. |
| 753 | + container.css('width', ''); |
745 | 754 | } |
746 | 755 | }, |
747 | 756 |
|
|
0 commit comments