From 9c69ca691503a37a7ff3f8b02343153ac90f87c3 Mon Sep 17 00:00:00 2001 From: lubber-de Date: Wed, 12 Dec 2018 13:21:10 +0100 Subject: [PATCH 1/3] fix(dropdown): display "no results fround" when remote api returns nothing and filterRemoteData is false --- src/definitions/modules/dropdown.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index e6ba83c47e..46afaa5aa5 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -782,16 +782,17 @@ $.fn.dropdown = function(parameters) { }, onSuccess : function(response) { var - values = response[fields.remoteValues], - hasRemoteValues = (Array.isArray(values) && values.length > 0) + values = response[fields.remoteValues] ; - if(hasRemoteValues) { - module.remove.message(); - module.setup.menu({ - values: response[fields.remoteValues] - }); + if (!Array.isArray(values)){ + values = []; } - else { + module.remove.message(); + module.setup.menu({ + values: values + }); + + if(values.length===0) { module.add.message(message.noResults); } callback(); From 8b32ff7cc48d754113432bd2abd006c9e73135bd Mon Sep 17 00:00:00 2001 From: lubber-de Date: Wed, 12 Dec 2018 15:43:03 +0100 Subject: [PATCH 2/3] fix(dropdown): display "no results fround" only, if no additions are allowed --- src/definitions/modules/dropdown.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 46afaa5aa5..a649a19bad 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -792,7 +792,7 @@ $.fn.dropdown = function(parameters) { values: values }); - if(values.length===0) { + if(values.length===0 && !settings.allowAdditions) { module.add.message(message.noResults); } callback(); @@ -4009,7 +4009,7 @@ $.fn.dropdown.settings.templates = { // generates just menu from select menu: function(response, fields) { var - values = response[fields.values] || {}, + values = response[fields.values] || [], html = '' ; $.each(values, function(index, option) { From 0a30cecf43445f4c06409c386d63031281d0c355 Mon Sep 17 00:00:00 2001 From: Sean Date: Thu, 13 Dec 2018 09:54:52 +0000 Subject: [PATCH 3/3] fix(dropdown): add `,` to variable assignment --- src/definitions/modules/dropdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index d5228ce6de..bdb393c7ae 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -4055,7 +4055,7 @@ $.fn.dropdown.settings.templates = { menu: function(response, fields, preserveHTML) { var values = response[fields.values] || [], - html = '' + html = '', escape = $.fn.dropdown.settings.templates.escape ; $.each(values, function(index, option) {