fix: select2 issue (default value and change event)

This commit is contained in:
Leonardo Campos 2017-05-05 13:02:15 -03:00
parent 0c5f79f434
commit c60f202135

View File

@ -35,7 +35,13 @@ OHIF.mixins.formItem = new OHIF.Mixin({
return component.parseData(component.$element.val());
}
component.$element.val(value).trigger('change');
// Deferring the `change` event because it was being triggered before
// formItem.onMixins execution when a defaultValue was specified. In
// this case $elem.data('component') code from the event handler was
// returning `undefined` and breaking the app
Meteor.defer(() => {
component.$element.val(value).trigger('change');
})
};
// Disable or enable the component