From 3ccbb27d6aa0ff6130b0356edf252773a4ac90e2 Mon Sep 17 00:00:00 2001 From: Antonio Fortunato Date: Fri, 4 Aug 2017 16:27:32 +0200 Subject: [PATCH 1/2] minChars: 0 will show all results Bug fix. Now when minChars: 0 will show the full list of results --- src/jquery.tokeninput.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/jquery.tokeninput.js b/src/jquery.tokeninput.js index 4b69d823..90798714 100755 --- a/src/jquery.tokeninput.js +++ b/src/jquery.tokeninput.js @@ -258,7 +258,16 @@ return false; } else if ($(input).data("settings").tokenLimit === null || $(input).data("settings").tokenLimit !== token_count) { - show_dropdown_hint(); + if ($(input).data("settings").minChars == 0) { + + // set a timeout just long enough to let this function finish. + setTimeout(function () { + do_search(); + }, 5); + } else { + + show_dropdown_hint(); + } } token_list.addClass($(input).data("settings").classes.focused); }) @@ -950,7 +959,7 @@ function do_search() { var query = input_box.val(); - if(query && query.length) { + if ((query && query.length) || $(input).data("settings").minChars == 0) { if(selected_token) { deselect_token($(selected_token), POSITION.AFTER); } From 5d8826c60b23886839f2f970aaea0bc6f05b8c4d Mon Sep 17 00:00:00 2001 From: Antonio Fortunato Date: Thu, 22 Mar 2018 11:23:21 +0100 Subject: [PATCH 2/2] Update jquery.tokeninput.js --- src/jquery.tokeninput.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jquery.tokeninput.js b/src/jquery.tokeninput.js index 90798714..067788c0 100755 --- a/src/jquery.tokeninput.js +++ b/src/jquery.tokeninput.js @@ -6,6 +6,9 @@ * Licensed jointly under the GPL and MIT licenses, * choose which one suits your project best! * + * EDITED by antonio.fortunato + * here the fork: https://github.com/ilFortu/jquery-tokeninput + * enabled to show all results when the option minChars:0 */ ;(function ($) { var DEFAULT_SETTINGS = {