2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-25 14:17:45 +00:00

Rev for 1.2.14 release

This commit is contained in:
Tomas Kirda 2014-09-21 22:18:09 -05:00
parent fb920860c5
commit d71867a090
4 changed files with 21 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "devbridge-autocomplete",
"version": "1.2.13",
"version": "1.2.14",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"authors": [
"Tomas Kirda"

View File

@ -6,7 +6,7 @@
"ajax",
"autocomplete"
],
"version": "1.2.13",
"version": "1.2.14",
"author": {
"name": "Tomas Kirda",
"url": "https://github.com/tkirda"

View File

@ -1,5 +1,5 @@
/**
* Ajax Autocomplete for jQuery, version 1.2.13
* Ajax Autocomplete for jQuery, version 1.2.14
* (c) 2014 Tomas Kirda
*
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
@ -613,6 +613,7 @@
var that = this,
options = that.options,
groupBy = options.groupBy,
formatResult = options.formatResult,
value = that.getQuery(that.currentValue),
className = that.classes.suggestion,
@ -621,6 +622,18 @@
noSuggestionsContainer = $(that.noSuggestionsContainer),
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>';
},
index;
if (options.triggerSelectOnValidInput) {
@ -633,6 +646,10 @@
// Build suggestions inner HTML:
$.each(that.suggestions, function (i, suggestion) {
if (groupBy){
html += formatGroup(suggestion, value, i);
}
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>';
});

View File

@ -1,6 +1,6 @@
{
"name": "devbridge-autocomplete",
"version": "1.2.13",
"version": "1.2.14",
"description": "Autocomplete provides suggestions while you type into the text field.",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"author": "Tomas Kirda (https://twitter.com/tkirda)",