Browse Source

#2795, ignore change event on initial load when not fireOnInit

pull/2755/merge
Jack Lukic 9 years ago
parent
commit
bac6193db4
1 changed files with 7 additions and 2 deletions
  1. 9
      src/definitions/modules/dropdown.js

9
src/definitions/modules/dropdown.js

@ -2121,8 +2121,13 @@ $.fn.dropdown = function(parameters) {
module.debug('Updating input value', value, currentValue); module.debug('Updating input value', value, currentValue);
$input $input
.val(value) .val(value)
.trigger('change')
; ;
if(settings.fireOnInit === false && module.is.initialLoad()) {
module.debug('Input native change event ignored on initial load');
}
else {
$input.trigger('change');
}
} }
else { else {
module.verbose('Storing value in metadata', value, $input); module.verbose('Storing value in metadata', value, $input);
@ -2401,7 +2406,7 @@ $.fn.dropdown = function(parameters) {
} }
if(settings.fireOnInit === false && module.is.initialLoad()) { if(settings.fireOnInit === false && module.is.initialLoad()) {
module.verbose('No callback on initial load', settings.onAdd);
module.verbose('Skipping onadd callback on initial load', settings.onAdd);
} }
else { else {
settings.onAdd.call(element, addedValue, addedText, $selectedItem); settings.onAdd.call(element, addedValue, addedText, $selectedItem);

Loading…
Cancel
Save