|
@ -1656,6 +1656,9 @@ $.fn.dropdown = function(parameters) { |
|
|
// set values
|
|
|
// set values
|
|
|
if( $input.is('select') ) { |
|
|
if( $input.is('select') ) { |
|
|
module.debug('Setting multiple <select> values', value, $input); |
|
|
module.debug('Setting multiple <select> values', value, $input); |
|
|
|
|
|
if(settings.allowAdditions) { |
|
|
|
|
|
module.add.optionValue(value); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
value = value.join(settings.delimiter); |
|
|
value = value.join(settings.delimiter); |
|
@ -1672,7 +1675,6 @@ $.fn.dropdown = function(parameters) { |
|
|
.trigger('change') |
|
|
.trigger('change') |
|
|
; |
|
|
; |
|
|
settings.onChange.call(element, value, text, $selected); |
|
|
settings.onChange.call(element, value, text, $selected); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
module.verbose('Storing value in metadata', value, $input); |
|
|
module.verbose('Storing value in metadata', value, $input); |
|
@ -1807,6 +1809,34 @@ $.fn.dropdown = function(parameters) { |
|
|
; |
|
|
; |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
optionValue: function(values) { |
|
|
|
|
|
if(!$input.is('select')) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if(selectObserver) { |
|
|
|
|
|
selectObserver.disconnect(); |
|
|
|
|
|
} |
|
|
|
|
|
$.each(values, function(index, value) { |
|
|
|
|
|
var |
|
|
|
|
|
$option = $input.find('option[value="' + value + '"]'), |
|
|
|
|
|
hasOption = ($option.length > 0) |
|
|
|
|
|
; |
|
|
|
|
|
if(!hasOption) { |
|
|
|
|
|
$('<option/>') |
|
|
|
|
|
.prop('value', value) |
|
|
|
|
|
.html(value) |
|
|
|
|
|
.appendTo($input) |
|
|
|
|
|
; |
|
|
|
|
|
module.verbose('Adding user addition as an <option>', value); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if(selectObserver) { |
|
|
|
|
|
selectObserver.observe($input[0], { |
|
|
|
|
|
childList : true, |
|
|
|
|
|
subtree : true |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
userChoice: function(value) { |
|
|
userChoice: function(value) { |
|
|
var |
|
|
var |
|
|
alreadyHasValue = module.get.item(value), |
|
|
alreadyHasValue = module.get.item(value), |
|
@ -1817,9 +1847,7 @@ $.fn.dropdown = function(parameters) { |
|
|
$addition.remove(); |
|
|
$addition.remove(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
html = settings.templates.addition(value); |
|
|
html = settings.templates.addition(value); |
|
|
|
|
|
|
|
|
$item |
|
|
$item |
|
|
.removeClass(className.selected) |
|
|
.removeClass(className.selected) |
|
|
; |
|
|
; |
|
|