Fixing issue with select2 rebuilding

This commit is contained in:
Bruno Alves de Faria 2017-10-27 23:04:11 -02:00
parent b7a8297fe0
commit 5a5ea1907a

View File

@ -77,7 +77,7 @@ OHIF.mixins.select2 = new OHIF.Mixin({
const { component, data } = instance; const { component, data } = instance;
// Destroy and re-create the select2 instance // Destroy and re-create the select2 instance
const rebuildSelect2 = () => { instance.rebuildSelect2 = () => {
// Destroy the select2 instance if exists and re-create it // Destroy the select2 instance if exists and re-create it
if (component.select2Instance) { if (component.select2Instance) {
component.select2Instance.destroy(); component.select2Instance.destroy();
@ -143,11 +143,11 @@ OHIF.mixins.select2 = new OHIF.Mixin({
// Keep the current value of the component // Keep the current value of the component
const currentValue = component.value(); const currentValue = component.value();
Tracker.afterFlush(() => { Tracker.afterFlush(() => {
rebuildSelect2();
component.$element.val(currentValue); component.$element.val(currentValue);
instance.rebuildSelect2();
}); });
} else { } else {
rebuildSelect2(); instance.rebuildSelect2();
} }
}); });
}, },