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

Fix event loop

parent 8d938182
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ class PersonSelect extends VPULitElementJQuery { ...@@ -26,6 +26,7 @@ class PersonSelect extends VPULitElementJQuery {
// For some reason using the same ID on the whole page twice breaks select2 (regardless if they are in different custom elements) // For some reason using the same ID on the whole page twice breaks select2 (regardless if they are in different custom elements)
this.selectId = 'person-select-' + commonUtils.makeId(24); this.selectId = 'person-select-' + commonUtils.makeId(24);
this.value = ''; this.value = '';
this.ignoreValueUpdate = false;
} }
static get properties() { static get properties() {
...@@ -131,9 +132,9 @@ class PersonSelect extends VPULitElementJQuery { ...@@ -131,9 +132,9 @@ class PersonSelect extends VPULitElementJQuery {
$this.attr("data-object", JSON.stringify(object)); $this.attr("data-object", JSON.stringify(object));
$this.data("object", object); $this.data("object", object);
$this.val(identifier);
if ($this.attr("value") !== identifier) { if ($this.attr("value") !== identifier) {
that.ignoreValueUpdate = true;
$this.attr("value", identifier); $this.attr("value", identifier);
// fire a change event // fire a change event
...@@ -192,9 +193,13 @@ class PersonSelect extends VPULitElementJQuery { ...@@ -192,9 +193,13 @@ class PersonSelect extends VPULitElementJQuery {
} }
break; break;
case "value": case "value":
if (this.$select !== null && this.$select.hasClass("select2-hidden-accessible")) { console.log("oldValue: " + oldValue);
console.log("this.value: " + this.value);
if (!this.ignoreValueUpdate && this.$select !== null && this.$select.hasClass("select2-hidden-accessible")) {
this.initSelect2(); this.initSelect2();
} }
this.ignoreValueUpdate = false;
break; break;
case "entryPointUrl": case "entryPointUrl":
const that = this; const that = this;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment