From fb3e16cd7406249f5fc07e63e952e6037157ebee Mon Sep 17 00:00:00 2001 From: josedetorre <44461530+josedetorre@users.noreply.github.com> Date: Thu, 25 Oct 2018 12:47:15 +0200 Subject: [PATCH 1/4] #20181025UC - FORCE VALUES Hi there, I've developed a feature to let some values in the list to be allways selected (forced) In a list of Countries I needed to offer the user the "None of them" option ("Spain", "France", "UK", "Italy", "Other") so when she enters FR, the list returns "France", "Other", to let her choose default values. So, I 'm trying to set up a fork that needs three files and I am an absolutely NOOB at GitHub but I found this interesting and I liked to share. I've I upload wrong, please sorry for the inconvenience. --- src/proccessData.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/proccessData.js b/src/proccessData.js index b227fc5..12d9add 100644 --- a/src/proccessData.js +++ b/src/proccessData.js @@ -24,20 +24,23 @@ var EasyAutocomplete = (function(scope) { function findMatch(list, phrase) { - var preparedList = [], - value = ""; + var preparedList = [], + value = "", + force = false; if (config.get("list").match.enabled) { - for(var i = 0, length = list.length; i < length; i += 1) { + 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]); - } - - } + value = config.get("getValue")(list[i]); + force = list[i].force; + + if (match(value, phrase)) { + preparedList.push(list[i]); + } else if ((force != undefined) && (force == true)) { + preparedList.push(list[i]); + } + } } else { preparedList = list; @@ -92,4 +95,3 @@ var EasyAutocomplete = (function(scope) { })(EasyAutocomplete || {}); - From f269c4db5448663e45d74eb3cf585488a6ef07cf Mon Sep 17 00:00:00 2001 From: josedetorre <44461530+josedetorre@users.noreply.github.com> Date: Thu, 25 Oct 2018 12:49:04 +0200 Subject: [PATCH 2/4] #20181025UC - FORCE VALUES - CORE SEE #20181025UC - FORCE VALUES --- src/core.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index 4203dfa..ab4d227 100644 --- a/src/core.js +++ b/src/core.js @@ -268,9 +268,17 @@ var EasyAutocomplete = (function(scope) { $listContainer.append("