From fc000b74d038e13ff74bbef802d8ee02e2188a02 Mon Sep 17 00:00:00 2001 From: Marco 'Lubber' Wienkoop Date: Thu, 13 Dec 2018 10:57:44 +0100 Subject: [PATCH] fix(dropdown): filter preselected entries from #287 was not working for div-dropdowns --- src/definitions/modules/dropdown.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 862685f098..8aec5b70fc 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -745,7 +745,11 @@ $.fn.dropdown = function(parameters) { if(settings.filterRemoteData) { module.filterItems(searchTerm); } - $.each($input.val(),function(index,value){ + var preSelected = $input.val(); + if(!Array.isArray(preSelected)) { + preSelected = preSelected!=="" ? preSelected.split(settings.delimiter) : []; + } + $.each(preSelected,function(index,value){ $item.filter('[data-value="'+value+'"]') .addClass(className.filtered) ;