|
87 | 87 | transformResult: function (response) { |
88 | 88 | return typeof response === 'string' ? $.parseJSON(response) : response; |
89 | 89 | }, |
| 90 | + suggestionHtml: function(i, suggestion, value, classes, options) { |
| 91 | + return '<div class="' + classes.suggestion + '" data-index="' + i + '">' + options.formatResult(suggestion, value) + '</div>'; |
| 92 | + }, |
90 | 93 | showNoSuggestionNotice: false, |
91 | 94 | noSuggestionNotice: 'No results', |
92 | 95 | orientation: 'bottom', |
|
613 | 616 |
|
614 | 617 | var that = this, |
615 | 618 | options = that.options, |
| 619 | + classes = that.classes, |
616 | 620 | groupBy = options.groupBy, |
617 | 621 | formatResult = options.formatResult, |
618 | 622 | value = that.getQuery(that.currentValue), |
619 | | - className = that.classes.suggestion, |
620 | | - classSelected = that.classes.selected, |
621 | 623 | container = $(that.suggestionsContainer), |
622 | 624 | noSuggestionsContainer = $(that.noSuggestionsContainer), |
623 | 625 | beforeRender = options.beforeRender, |
|
650 | 652 | html += formatGroup(suggestion, value, i); |
651 | 653 | } |
652 | 654 |
|
653 | | - html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>'; |
| 655 | + html += options.suggestionHtml(i, suggestion, value, classes, options); |
654 | 656 | }); |
655 | 657 |
|
656 | | - this.adjustContainerWidth(); |
| 658 | + this.adjustContainerWidth(); |
657 | 659 |
|
658 | 660 | noSuggestionsContainer.detach(); |
659 | 661 | container.html(html); |
|
0 commit comments