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

Don't do a change event if value was not changed

parent 3d99aa17
No related branches found
No related tags found
No related merge requests found
...@@ -125,14 +125,16 @@ class PersonSelect extends VPULitElementJQuery { ...@@ -125,14 +125,16 @@ class PersonSelect extends VPULitElementJQuery {
} }
} }
}).on("select2:select", function (e) { }).on("select2:select", function (e) {
// set value custom element // set custom element attributes
const identifier = e.params.data.id; const identifier = e.params.data.id;
$this.attr("value", identifier);
$this.val(identifier);
const object = findObjectInApiResults(identifier, lastResult); const object = findObjectInApiResults(identifier, lastResult);
$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) {
$this.attr("value", identifier);
// fire a change event // fire a change event
that.dispatchEvent(new CustomEvent('change', { that.dispatchEvent(new CustomEvent('change', {
...@@ -141,6 +143,7 @@ class PersonSelect extends VPULitElementJQuery { ...@@ -141,6 +143,7 @@ class PersonSelect extends VPULitElementJQuery {
}, },
bubbles: true bubbles: true
})); }));
}
}); });
// preset a person // preset a person
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment