Browse Source

Prevent looping for values in multiple if no values set

pull/2390/head
jlukic 9 years ago
parent
commit
fcd8f69108
1 changed files with 7 additions and 1 deletions
  1. 8
      src/definitions/modules/dropdown.js

8
src/definitions/modules/dropdown.js

@ -1508,6 +1508,7 @@ $.fn.dropdown = function(parameters) {
item: function(value, strict) { item: function(value, strict) {
var var
$selectedItem = false, $selectedItem = false,
shouldSearch,
isMultiple isMultiple
; ;
value = (value !== undefined) value = (value !== undefined)
@ -1516,12 +1517,16 @@ $.fn.dropdown = function(parameters) {
? module.get.values() ? module.get.values()
: module.get.text() : module.get.text()
; ;
shouldSearch = (isMultiple)
? (value.length > 0)
: (value !== undefined && value !== null)
;
isMultiple = (module.is.multiple() && $.isArray(value)); isMultiple = (module.is.multiple() && $.isArray(value));
strict = (value === '' || value === 0) strict = (value === '' || value === 0)
? true ? true
: strict || false : strict || false
; ;
if(value !== undefined && value !== null) {
if(shouldSearch) {
$item $item
.each(function() { .each(function() {
var var
@ -1640,6 +1645,7 @@ $.fn.dropdown = function(parameters) {
} }
}, },
values: function() { values: function() {
// prevents callbacks from occuring if specified for initial load
module.set.initialLoad(); module.set.initialLoad();
if(settings.apiSettings) { if(settings.apiSettings) {
if(settings.saveRemoteData) { if(settings.saveRemoteData) {

Loading…
Cancel
Save