Convert the whole request to json at once on select widget

This commit is contained in:
2024-10-21 17:11:07 +02:00
parent 3eb3feea49
commit e583e78a4e
3 changed files with 19 additions and 17 deletions

View File

@ -165,9 +165,8 @@ export abstract class AjaxSelect extends AutoCompleteSelectBase {
connectedCallback() {
/* Capture initial values before they get moved to the inner node and overridden by tom-select */
this.initialValues = Array.from(this.children)
.filter((child: Element) => child.tagName.toLowerCase() === "slot")
.map((slot) => JSON.parse(slot.innerHTML));
const initial = this.querySelector("slot[name='initial']")?.textContent;
this.initialValues = initial ? JSON.parse(initial) : [];
super.connectedCallback();
}