Skip to content

Commit d71867a

Browse files
author
Tomas Kirda
committed
Rev for 1.2.14 release
1 parent fb92086 commit d71867a

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devbridge-autocomplete",
3-
"version": "1.2.13",
3+
"version": "1.2.14",
44
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
55
"authors": [
66
"Tomas Kirda"

devbridge-autocomplete.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"ajax",
77
"autocomplete"
88
],
9-
"version": "1.2.13",
9+
"version": "1.2.14",
1010
"author": {
1111
"name": "Tomas Kirda",
1212
"url": "https://github.com/tkirda"

dist/jquery.autocomplete.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Ajax Autocomplete for jQuery, version 1.2.13
2+
* Ajax Autocomplete for jQuery, version 1.2.14
33
* (c) 2014 Tomas Kirda
44
*
55
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
@@ -613,6 +613,7 @@
613613

614614
var that = this,
615615
options = that.options,
616+
groupBy = options.groupBy,
616617
formatResult = options.formatResult,
617618
value = that.getQuery(that.currentValue),
618619
className = that.classes.suggestion,
@@ -621,6 +622,18 @@
621622
noSuggestionsContainer = $(that.noSuggestionsContainer),
622623
beforeRender = options.beforeRender,
623624
html = '',
625+
category,
626+
formatGroup = function (suggestion, index) {
627+
var currentCategory = suggestion.data[groupBy];
628+
629+
if (category === currentCategory){
630+
return '';
631+
}
632+
633+
category = currentCategory;
634+
635+
return '<div class="autocomplete-group"><strong>' + category + '</strong></div>';
636+
},
624637
index;
625638

626639
if (options.triggerSelectOnValidInput) {
@@ -633,6 +646,10 @@
633646

634647
// Build suggestions inner HTML:
635648
$.each(that.suggestions, function (i, suggestion) {
649+
if (groupBy){
650+
html += formatGroup(suggestion, value, i);
651+
}
652+
636653
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>';
637654
});
638655

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devbridge-autocomplete",
3-
"version": "1.2.13",
3+
"version": "1.2.14",
44
"description": "Autocomplete provides suggestions while you type into the text field.",
55
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
66
"author": "Tomas Kirda (https://twitter.com/tkirda)",

0 commit comments

Comments
 (0)