Fixing issue with select2 rebuilding
This commit is contained in:
parent
b7a8297fe0
commit
5a5ea1907a
@ -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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user