Skip to content
Snippets Groups Projects
Commit ded874f8 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Fix error on not initialized selector

parent c89d78e3
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,11 @@ class PersonSelect extends VPULitElementJQuery {
$(that).blur(() => {
// the 500ms delay is a workaround to actually get an item selected when clicking on it,
// because the blur gets also fired when clicking in the selector
setTimeout(() => {that.$select.select2('close')}, 500);
setTimeout(() => {
if (this.select2IsInitialized()) {
that.$select.select2('close');
}
}, 500);
});
// try an init when user-interface is loaded
......@@ -218,13 +222,13 @@ class PersonSelect extends VPULitElementJQuery {
case "lang":
i18n.changeLanguage(this.lang);
if (this.$select !== null && this.$select.hasClass("select2-hidden-accessible")) {
if (this.select2IsInitialized()) {
// no other way to set an other language at runtime did work
this.initSelect2(true);
}
break;
case "value":
if (!this.ignoreValueUpdate && this.$select !== null && this.$select.hasClass("select2-hidden-accessible")) {
if (!this.ignoreValueUpdate && this.select2IsInitialized()) {
this.initSelect2();
}
......@@ -239,6 +243,10 @@ class PersonSelect extends VPULitElementJQuery {
super.update(changedProperties);
}
select2IsInitialized() {
return this.$select !== null && this.$select.hasClass("select2-hidden-accessible");
}
static get styles() {
// language=css
return css`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment