From baf03b8f598f10c045d40652cbb6db73cdcab973 Mon Sep 17 00:00:00 2001 From: nosoccomtothom Date: Tue, 5 Jun 2018 09:38:28 +0200 Subject: [PATCH 1/4] Added the infinite scroll handling dist/jQuery.easy-autocomplete.js (Updated) - Handles dropdown list with infite scrollfunctionality appending data (to_append). - Blocks the infinite scroll trigger when updating results or fetching new results (scroll_enabled) - AJAX command is defined and updated along the code when needed (ajax_url) - Resets the content upon character typed demo/example_scroll.html (Created) - Inserts bottom scroll handling which triggers an undefined keyup picked - Handles the number of records to retrieve and its offset (delta, delta_counter, offset_rows) --- demo/example_scroll.html | 67 +++++++ dist/jquery.easy-autocomplete.js | 309 +++++++++++++++++++------------ 2 files changed, 259 insertions(+), 117 deletions(-) create mode 100644 demo/example_scroll.html diff --git a/demo/example_scroll.html b/demo/example_scroll.html new file mode 100644 index 0000000..69749c2 --- /dev/null +++ b/demo/example_scroll.html @@ -0,0 +1,67 @@ + + + + EasyAutocomplete categories + + + + + + + + + +

EasyAutocomplete - categories infinite scroll

+ + + + + + + + diff --git a/dist/jquery.easy-autocomplete.js b/dist/jquery.easy-autocomplete.js index 88f2951..2ba29dd 100644 --- a/dist/jquery.easy-autocomplete.js +++ b/dist/jquery.easy-autocomplete.js @@ -1,15 +1,29 @@ /* * easy-autocomplete * jQuery plugin for autocompletion - * + * * @author Łukasz Pawełczak (http://github.com/pawelczak) * @version 1.3.5 - * Copyright License: + * Copyright License: + * 20180603 + * Updated and patched for incremental data append + * @author Esteve Serra Clavera */ /* - * EasyAutocomplete - Configuration + * EasyAutocomplete - Configuration */ + + function printObject(o) { + var out = ''; + for (var p in o) { + + + out += p + ': ' + JSON.stringify(o[p],null,4) + '\n'; + } + console.log(out); + } + var EasyAutocomplete = (function(scope){ scope.Configuration = function Configuration(options) { @@ -88,7 +102,7 @@ var EasyAutocomplete = (function(scope){ onChooseEvent: function() {}, onKeyEnterEvent: function() {}, onMouseOverEvent: function() {}, - onMouseOutEvent: function() {}, + onMouseOutEvent: function() {}, onShowListEvent: function() {}, onHideListEvent: function() {} }, @@ -120,7 +134,7 @@ var EasyAutocomplete = (function(scope){ }] }; - + var externalObjects = ["ajaxSettings", "template"]; this.get = function(propertyName) { @@ -132,8 +146,8 @@ var EasyAutocomplete = (function(scope){ if (defaults[name] === value) { return true; } - } - + } + return false; }; @@ -163,16 +177,17 @@ var EasyAutocomplete = (function(scope){ mergeOptions(); if (defaults.loggerEnabled === true) { - printPropertiesThatDoesntExist(console, options); + printPropertiesThatDoesntExist(console, options); } addAjaxSettings(); processAfterMerge(); + function prepareDefaults() { if (options.dataType === "xml") { - + if (!options.getValue) { options.getValue = function(element) { @@ -180,11 +195,11 @@ var EasyAutocomplete = (function(scope){ }; } - + if (!options.list) { options.list = {}; - } + } if (!options.list.sort) { options.list.sort = {}; @@ -221,7 +236,7 @@ var EasyAutocomplete = (function(scope){ var categories = []; - for (var i = 0, length = options.categories.length; i < length; i += 1) { + for (var i = 0, length = options.categories.length; i < length; i += 1) { var category = options.categories[i]; @@ -249,7 +264,7 @@ var EasyAutocomplete = (function(scope){ for (var propertyName in source) { if (target[propertyName] !== undefined && target[propertyName] !== null) { - if (typeof target[propertyName] !== "object" || + if (typeof target[propertyName] !== "object" || target[propertyName] instanceof Array) { mergedObject[propertyName] = target[propertyName]; } else { @@ -257,7 +272,7 @@ var EasyAutocomplete = (function(scope){ } } } - + /* If data is an object */ if (target.data !== undefined && target.data !== null && typeof target.data === "object") { mergedObject.data = target.data; @@ -265,11 +280,11 @@ var EasyAutocomplete = (function(scope){ return mergedObject; } - } + } function processAfterMerge() { - + if (defaults.url !== "list-required" && typeof defaults.url !== "function") { var defaultUrl = defaults.url; defaults.url = function() { @@ -294,7 +309,7 @@ var EasyAutocomplete = (function(scope){ } else { defaults.listLocation = function(data) { return data[defaultlistLocation]; - }; + }; } } @@ -316,9 +331,9 @@ var EasyAutocomplete = (function(scope){ if (options.ajaxSettings !== undefined && typeof options.ajaxSettings === "object") { defaults.ajaxSettings = options.ajaxSettings; } else { - defaults.ajaxSettings = {}; + defaults.ajaxSettings = {}; } - + } function isAssigned(name) { @@ -329,19 +344,19 @@ var EasyAutocomplete = (function(scope){ } } function printPropertiesThatDoesntExist(consol, optionsToCheck) { - + checkPropertiesIfExist(defaults, optionsToCheck); function checkPropertiesIfExist(source, target) { for(var property in target) { if (source[property] === undefined) { - consol.log("Property '" + property + "' does not exist in EasyAutocomplete options API."); + consol.log("Property '" + property + "' does not exist in EasyAutocomplete options API."); } if (typeof source[property] === "object" && $.inArray(property, externalObjects) === -1) { checkPropertiesIfExist(source[property], target[property]); } - } + } } } }; @@ -352,10 +367,10 @@ var EasyAutocomplete = (function(scope){ /* - * EasyAutocomplete - Logger + * EasyAutocomplete - Logger */ var EasyAutocomplete = (function(scope){ - + scope.Logger = function Logger() { this.error = function(message) { @@ -370,13 +385,13 @@ var EasyAutocomplete = (function(scope){ return scope; })(EasyAutocomplete || {}); - + /* * EasyAutocomplete - Constans */ -var EasyAutocomplete = (function(scope){ - +var EasyAutocomplete = (function(scope){ + scope.Constans = function Constans() { var constants = { CONTAINER_CLASS: "easy-autocomplete-container", @@ -396,9 +411,9 @@ var EasyAutocomplete = (function(scope){ })(EasyAutocomplete || {}); /* - * EasyAutocomplete - ListBuilderService + * EasyAutocomplete - ListBuilderService * - * @author Łukasz Pawełczak + * @author Łukasz Pawełczak * */ var EasyAutocomplete = (function(scope) { @@ -407,21 +422,23 @@ var EasyAutocomplete = (function(scope) { this.init = function(data) { + var listBuilder = [], builder = {}; - builder.data = configuration.get("listLocation")(data); - builder.getValue = configuration.get("getValue"); - builder.maxListSize = configuration.get("list").maxNumberOfElements; + builder.data = configuration.get("listLocation")(data); + builder.getValue = configuration.get("getValue"); + builder.maxListSize = configuration.get("list").maxNumberOfElements; - - listBuilder.push(builder); + num_records = builder.data.length; + //console.log('Builder data'); + //printObject(builder.data); + listBuilder.push(builder); return listBuilder; }; - this.updateCategories = function(listBuilder, data) { - + if (configuration.get("categoriesAssigned")) { listBuilder = []; @@ -433,7 +450,7 @@ var EasyAutocomplete = (function(scope) { listBuilder.push(builder); } - } + } return listBuilder; }; @@ -454,7 +471,6 @@ var EasyAutocomplete = (function(scope) { for(var i = 0, length = listBuilder.length; i < length; i+=1) { listBuilder[i].data = proccessResponseData(configuration, listBuilder[i], inputPhrase); } - return listBuilder; }; @@ -466,7 +482,7 @@ var EasyAutocomplete = (function(scope) { if (listBuilders[i].data.length > 0) { return true; } - } + } } return false; @@ -484,7 +500,7 @@ var EasyAutocomplete = (function(scope) { builder = convertDataToListBuilder(); } - + if (category.header !== undefined) { builder.header = category.header; @@ -511,9 +527,9 @@ var EasyAutocomplete = (function(scope) { } } else { - builder.getValue = configuration.get("getValue"); + builder.getValue = configuration.get("getValue"); } - + return builder; @@ -537,13 +553,13 @@ var EasyAutocomplete = (function(scope) { if (listLocation !== undefined) { if (typeof listLocation === "string") { + builder.data = $(data).find(listLocation); } else if (typeof listLocation === "function") { builder.data = listLocation(data); } } else { - builder.data = data; } @@ -596,7 +612,7 @@ var EasyAutocomplete = (function(scope) { * EasyAutocomplete - Data proccess module * * Process list to display: - * - sort + * - sort * - decrease number to specific number * - show only matching list * @@ -626,11 +642,11 @@ var EasyAutocomplete = (function(scope) { for(var i = 0, length = list.length; i < length; i += 1) { value = config.get("getValue")(list[i]); - + if (match(value, phrase)) { - preparedList.push(list[i]); + preparedList.push(list[i]); } - + } } else { @@ -645,9 +661,9 @@ var EasyAutocomplete = (function(scope) { if (!config.get("list").match.caseSensitive) { if (typeof value === "string") { - value = value.toLowerCase(); + value = value.toLowerCase(); } - + phrase = phrase.toLowerCase(); } if (config.get("list").match.method(value, phrase)) { @@ -672,7 +688,7 @@ var EasyAutocomplete = (function(scope) { return list; } - + }; @@ -683,9 +699,9 @@ var EasyAutocomplete = (function(scope) { /* - * EasyAutocomplete - Template + * EasyAutocomplete - Template + * * - * * */ var EasyAutocomplete = (function(scope){ @@ -757,16 +773,16 @@ var EasyAutocomplete = (function(scope){ if (template.type === "description") { - buildMethod = genericTemplates.description.method; + buildMethod = genericTemplates.description.method; if (typeof _fields.description === "string") { buildMethod = function(elementValue, element) { return elementValue + " - " + element[_fields.description] + ""; - }; + }; } else if (typeof _fields.description === "function") { buildMethod = function(elementValue, element) { return elementValue + " - " + _fields.description(element) + ""; - }; + }; } return buildMethod; @@ -777,7 +793,7 @@ var EasyAutocomplete = (function(scope){ if (typeof _fields.iconSrc === "string") { buildMethod = function(elementValue, element) { return elementValue + "" ; - }; + }; } else if (typeof _fields.iconSrc === "function") { buildMethod = function(elementValue, element) { return elementValue + "" ; @@ -793,7 +809,7 @@ var EasyAutocomplete = (function(scope){ if (typeof _fields.iconSrc === "string") { buildMethod = function(elementValue, element) { return "" + elementValue; - }; + }; } else if (typeof _fields.iconSrc === "function") { buildMethod = function(elementValue, element) { return "" + elementValue; @@ -808,7 +824,7 @@ var EasyAutocomplete = (function(scope){ if (typeof _fields.link === "string") { buildMethod = function(elementValue, element) { return "" + elementValue + ""; - }; + }; } else if (typeof _fields.link === "function") { buildMethod = function(elementValue, element) { return "" + elementValue + ""; @@ -854,7 +870,7 @@ var EasyAutocomplete = (function(scope){ } if (options.type && genericTemplates[options.type]) { - return (function () { + return (function () { var _cssClass = genericTemplates[options.type].cssClass; return function() { return _cssClass;}; })(); @@ -882,9 +898,9 @@ var EasyAutocomplete = (function(scope){ */ var EasyAutocomplete = (function(scope) { - + scope.main = function Core($input, options) { - + var module = { name: "EasyAutocomplete", shortcut: "eac" @@ -897,7 +913,7 @@ var EasyAutocomplete = (function(scope) { listBuilderService = new scope.ListBuilderService(config, scope.proccess), checkParam = config.equals, - $field = $input, + $field = $input, $container = "", elementsList = [], selectedElement = -1, @@ -963,20 +979,22 @@ var EasyAutocomplete = (function(scope) { } - prepareField(); - bindEvents(); + if(to_append === false){ + prepareField(); + } + bindEvents(); } function prepareField() { - + if ($field.parent().hasClass(consts.getValue("WRAPPER_CSS_CLASS"))) { removeContainer(); removeWrapper(); - } - + } + createWrapper(); - createContainer(); + createContainer(); $container = $("#" + getContainerId()); if (config.get("placeholder")) { @@ -988,7 +1006,7 @@ var EasyAutocomplete = (function(scope) { var $wrapper = $("
"), classes = consts.getValue("WRAPPER_CSS_CLASS"); - + if (config.get("theme") && config.get("theme") !== "") { classes += " eac-" + config.get("theme"); } @@ -1000,7 +1018,7 @@ var EasyAutocomplete = (function(scope) { if (template.getTemplateClass() !== "") { classes += " " + template.getTemplateClass(); } - + $wrapper .addClass(classes); @@ -1008,16 +1026,16 @@ var EasyAutocomplete = (function(scope) { if (config.get("adjustWidth") === true) { - adjustWrapperWidth(); + adjustWrapperWidth(); } - + } function adjustWrapperWidth() { var fieldWidth = $field.outerWidth(); - $field.parent().css("width", fieldWidth); + $field.parent().css("width", fieldWidth); } function removeWrapper() { @@ -1060,7 +1078,7 @@ var EasyAutocomplete = (function(scope) { } config.get("list").onShowListEvent(); - + }) /* List hide animation */ .on("hide.eac", function() { @@ -1096,14 +1114,15 @@ var EasyAutocomplete = (function(scope) { config.get("list").onSelectItemEvent(); }) .on("loadElements.eac", function(event, listBuilders, phrase) { - var $item = "", $listContainer = $elements_container.find("ul"); - $listContainer - .empty() - .detach(); + if(to_append === false){ + $listContainer + .empty() + .detach(); + } elementsList = []; var counter = 0; @@ -1121,7 +1140,6 @@ var EasyAutocomplete = (function(scope) { for(var i = 0, listDataLength = listData.length; i < listDataLength && counter < listBuilders[builderIndex].maxListSize; i += 1) { $item = $("
  • "); - (function() { var j = i, @@ -1142,7 +1160,7 @@ var EasyAutocomplete = (function(scope) { .mouseover(function() { selectedElement = itemCounter; - selectElement(itemCounter); + selectElement(itemCounter); config.get("list").onMouseOverEvent(); }) @@ -1151,16 +1169,35 @@ var EasyAutocomplete = (function(scope) { }) .html(template.build(highlight(elementsValue, phrase), listData[j])); })(); - $listContainer.append($item); elementsList.push(listData[i]); counter += 1; } } - $elements_container.append($listContainer); + console.log('Number of to-be loaded records: ' + listBuilders[0].data.length); + if(listBuilders[0].data.length>0){ + console.log('Number of records: ' + num_records); + console.log('Number of delta records: ' + delta); + if(num_records 40 || event.keyCode === 8) { + console.log('Key detected'); + initVars(); + console.log('Counter: '+ delta_counter); + console.log('Delta: '+ delta); + console.log('Offset: '+ offset_rows); var inputPhrase = $field.val(); @@ -1311,16 +1360,22 @@ var EasyAutocomplete = (function(scope) { } else { hideContainer(); } - - } + + } else if (event.keyCode === undefined) { + offset = delta*delta_counter + delta; + console.log("Keyup triggered by bottom scroll"); + console.log('Counter: '+ delta_counter); + console.log('Delta: '+ delta); + console.log('Offset: '+ offset_rows); + loadData($("#buscador").val()); + } break; } - - function loadData(inputPhrase) { + function loadData(inputPhrase) { if (inputPhrase.length < config.get("minCharNumber")) { return; @@ -1334,13 +1389,13 @@ var EasyAutocomplete = (function(scope) { var listBuilders = listBuilderService.init(data); listBuilders = listBuilderService.updateCategories(listBuilders, data); - + listBuilders = listBuilderService.processData(listBuilders, inputPhrase); loadElements(listBuilders, inputPhrase); if ($field.parent().find("li").length > 0) { - showContainer(); + showContainer(); } else { hideContainer(); } @@ -1356,32 +1411,36 @@ var EasyAutocomplete = (function(scope) { if (settings.dataType === undefined || settings.dataType === "") { settings.dataType = config.get("dataType"); } - + ajax_url = '/_get_autocomplete?word='+ inputPhrase + '&offset=' + offset_rows; + console.log('Crafting ajax url: ' + ajax_url); if (settings.url !== undefined && settings.url !== "list-required") { - settings.url = settings.url(inputPhrase); settings.data = config.get("preparePostData")(settings.data, inputPhrase); - - $.ajax(settings) + console.log(settings.url); + console.log(settings.dataType); + $.ajax(settings) .done(function(data) { - + console.log('AJAX call'); + printObject(data); var listBuilders = listBuilderService.init(data); listBuilders = listBuilderService.updateCategories(listBuilders, data); - + listBuilders = listBuilderService.convertXml(listBuilders); + + global_list = listBuilders; + if (checkInputPhraseMatchResponse(inputPhrase, data)) { listBuilders = listBuilderService.processData(listBuilders, inputPhrase); + loadElements(listBuilders, inputPhrase); - loadElements(listBuilders, inputPhrase); - } - if (listBuilderService.checkIfDataExists(listBuilders) && $field.parent().find("li").length > 0) { - showContainer(); + if (listBuilderService.checkIfDataExists(listBuilders) && $field.parent().find("li").length > 0) { + showContainer(); } else { hideContainer(); } @@ -1397,7 +1456,7 @@ var EasyAutocomplete = (function(scope) { }); } - + function createAjaxSettings() { @@ -1441,7 +1500,7 @@ var EasyAutocomplete = (function(scope) { evt = evt || window.event; var keyCode = evt.keyCode; if (keyCode === 38) { - suppressKeypress = true; + suppressKeypress = true; return false; } }) @@ -1471,18 +1530,18 @@ var EasyAutocomplete = (function(scope) { $field.focus(function() { if ($field.val() !== "" && elementsList.length > 0) { - + selectedElement = -1; - showContainer(); + showContainer(); } - + }); } function bindBlur() { $field.blur(function() { - setTimeout(function() { - + setTimeout(function() { + selectedElement = -1; hideContainer(); }, 250); @@ -1504,12 +1563,28 @@ var EasyAutocomplete = (function(scope) { } function selectElement(index) { - + $container.trigger("selectElement.eac", index); } function loadElements(list, phrase) { - $container.trigger("loadElements.eac", [list, phrase]); + + if (to_append){ + //Assigning otherwise undefined + $container = $("#eac-container-buscador"); + console.log('LoadElements to append: '); + //console.log($container); + }else{ + console.log('LoadElements not to append: '); + //console.log($container); + } + + if(list[0].data.length>0){ + $container.trigger("loadElements.eac", [list, phrase]); + }else{ + console.log('No items so scroll is disabled'); + scroll_enabled = false; + } } function loseFieldFocus() { @@ -1539,13 +1614,13 @@ var EasyAutocomplete = (function(scope) { var fieldId = ""; do { - fieldId = "eac-" + Math.floor(Math.random() * 10000); + fieldId = "eac-" + Math.floor(Math.random() * 10000); } while ($("#" + fieldId).length !== 0); - + elementId = scope.consts.getValue("CONTAINER_ID") + fieldId; $(input).attr("id", fieldId); - + }; scope.setHandle = function(handle, id) { From 622e2db7ce98bcfa9a95f42d9829c97c7544db25 Mon Sep 17 00:00:00 2001 From: nosoccomtothom Date: Tue, 5 Jun 2018 13:37:46 +0200 Subject: [PATCH 2/4] Fied the items' actions (mouseover, etc) as well as scroll protection upon dropdown goes hidden jquery.easy-autocomplete.js (Updated) -Kept log of amount of items loaded for item actions handling (loaded_results_num) -Added scroll protection when dropdown is hidden (ESC or clocking outside) --- dist/jquery.easy-autocomplete.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dist/jquery.easy-autocomplete.js b/dist/jquery.easy-autocomplete.js index 2ba29dd..bab51c9 100644 --- a/dist/jquery.easy-autocomplete.js +++ b/dist/jquery.easy-autocomplete.js @@ -426,14 +426,16 @@ var EasyAutocomplete = (function(scope) { var listBuilder = [], builder = {}; - builder.data = configuration.get("listLocation")(data); - builder.getValue = configuration.get("getValue"); - builder.maxListSize = configuration.get("list").maxNumberOfElements; + var loaded_results_num; - num_records = builder.data.length; - //console.log('Builder data'); - //printObject(builder.data); - listBuilder.push(builder); + builder.data = configuration.get("listLocation")(data); + builder.getValue = configuration.get("getValue"); + builder.maxListSize = configuration.get("list").maxNumberOfElements; + + num_records = builder.data.length; + //console.log('Builder data'); + //printObject(builder.data); + listBuilder.push(builder); return listBuilder; }; @@ -1073,6 +1075,7 @@ var EasyAutocomplete = (function(scope) { break; default: + scroll_enabled = true; $elements_container.find("ul").show(); break; } @@ -1143,7 +1146,7 @@ var EasyAutocomplete = (function(scope) { (function() { var j = i, - itemCounter = counter, + itemCounter = counter + loaded_results_num, elementsValue = listBuilders[builderIndex].getValue(listData[j]); $item.find(" > div") @@ -1175,6 +1178,7 @@ var EasyAutocomplete = (function(scope) { } } + loaded_results_num += listBuilders[0].data.length; console.log('Number of to-be loaded records: ' + listBuilders[0].data.length); if(listBuilders[0].data.length>0){ console.log('Number of records: ' + num_records); @@ -1294,6 +1298,7 @@ var EasyAutocomplete = (function(scope) { case 27: + scroll_enabled = false; hideContainer(); loseFieldFocus(); break; From 1ade2afbfddbf8358836c0d3f34a1c28a5482256 Mon Sep 17 00:00:00 2001 From: nosoccomtothom Date: Tue, 5 Jun 2018 15:48:13 +0200 Subject: [PATCH 3/4] Force no scroll when hidding the drodown jquery.easy-autocomplete.js (Updated) --- dist/jquery.easy-autocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/jquery.easy-autocomplete.js b/dist/jquery.easy-autocomplete.js index bab51c9..e19c004 100644 --- a/dist/jquery.easy-autocomplete.js +++ b/dist/jquery.easy-autocomplete.js @@ -1085,6 +1085,7 @@ var EasyAutocomplete = (function(scope) { }) /* List hide animation */ .on("hide.eac", function() { + scroll_enabled = false; switch(config.get("list").hideAnimation.type) { @@ -1298,7 +1299,6 @@ var EasyAutocomplete = (function(scope) { case 27: - scroll_enabled = false; hideContainer(); loseFieldFocus(); break; From 84129b19b218bfc75219d715136d595f320cb2e0 Mon Sep 17 00:00:00 2001 From: nosoccomtothom Date: Thu, 7 Jun 2018 12:24:33 +0200 Subject: [PATCH 4/4] Fix on data appending and managing scroll trigger jquery.easy-autocomplete.js (Updated) - Removed printObject - Disable scrolling when pressing ESC key example_scroll.html - Added printObject --- demo/example_scroll.html | 14 +++++++++++++- dist/jquery.easy-autocomplete.js | 18 +++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/demo/example_scroll.html b/demo/example_scroll.html index 69749c2..c11a272 100644 --- a/demo/example_scroll.html +++ b/demo/example_scroll.html @@ -18,10 +18,22 @@ var delta = 25; //Amount of records to retrieve var num_records = 0; //Amount of recrords retrieved var offset_rows; //To make it global + var loaded_results_num; + + function printObject(o) { + var out = ''; + for (var p in o) { + + + out += p + ': ' + JSON.stringify(o[p],null,4) + '\n'; + } + console.log(out); + } function initVars(){ delta_counter = 0; //Reseting for new string search - offset_rows = 0; // + offset_rows = 0; + loaded_results_num = 0; } jQuery(function($) { diff --git a/dist/jquery.easy-autocomplete.js b/dist/jquery.easy-autocomplete.js index e19c004..28e11dc 100644 --- a/dist/jquery.easy-autocomplete.js +++ b/dist/jquery.easy-autocomplete.js @@ -14,16 +14,6 @@ * EasyAutocomplete - Configuration */ - function printObject(o) { - var out = ''; - for (var p in o) { - - - out += p + ': ' + JSON.stringify(o[p],null,4) + '\n'; - } - console.log(out); - } - var EasyAutocomplete = (function(scope){ scope.Configuration = function Configuration(options) { @@ -1075,7 +1065,12 @@ var EasyAutocomplete = (function(scope) { break; default: - scroll_enabled = true; + if(num_records