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,22 +125,25 @@ class PersonSelect extends VPULitElementJQuery {
}
}
}).on("select2:select", function (e) {
// set value custom element
// set custom element attributes
const identifier = e.params.data.id;
$this.attr("value", identifier);
$this.val(identifier);
const object = findObjectInApiResults(identifier, lastResult);
$this.attr("data-object", JSON.stringify(object));
$this.data("object", object);
$this.val(identifier);
// fire a change event
that.dispatchEvent(new CustomEvent('change', {
detail: {
value: identifier,
},
bubbles: true
}));
if ($this.attr("value") !== identifier) {
$this.attr("value", identifier);
// fire a change event
that.dispatchEvent(new CustomEvent('change', {
detail: {
value: identifier,
},
bubbles: true
}));
}
});
// preset a person
......
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