From fcd8f6910802250064640d61a22c45b7e8cfe5dc Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 8 Jun 2015 14:20:10 -0400 Subject: [PATCH] Prevent looping for values in multiple if no values set --- src/definitions/modules/dropdown.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index b861b33cd..878982931 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -1508,6 +1508,7 @@ $.fn.dropdown = function(parameters) { item: function(value, strict) { var $selectedItem = false, + shouldSearch, isMultiple ; value = (value !== undefined) @@ -1516,12 +1517,16 @@ $.fn.dropdown = function(parameters) { ? module.get.values() : module.get.text() ; + shouldSearch = (isMultiple) + ? (value.length > 0) + : (value !== undefined && value !== null) + ; isMultiple = (module.is.multiple() && $.isArray(value)); strict = (value === '' || value === 0) ? true : strict || false ; - if(value !== undefined && value !== null) { + if(shouldSearch) { $item .each(function() { var @@ -1640,6 +1645,7 @@ $.fn.dropdown = function(parameters) { } }, values: function() { + // prevents callbacks from occuring if specified for initial load module.set.initialLoad(); if(settings.apiSettings) { if(settings.saveRemoteData) {