mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 02:43:22 +01:00
SearchMixin: Fix initial values not always displayed when options are from server or file
Fix for when remote result doesn't get there before SlSelect renders, and the SlSelect removed the value because the option wasn't there
This commit is contained in:
parent
a813d09ae5
commit
562a391579
@ -633,12 +633,13 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
|
|||||||
// Given a value we need to search for - this will add in all matches, including the one needed
|
// Given a value we need to search for - this will add in all matches, including the one needed
|
||||||
this.remoteSearch(newValueElement, this.searchOptions).then((result : SelectOption[]) =>
|
this.remoteSearch(newValueElement, this.searchOptions).then((result : SelectOption[]) =>
|
||||||
{
|
{
|
||||||
const option = <SelectOption>result.find(o => o.value == newValueElement);
|
// Re-set / update value since SlSelect probably removed it by now due to missing option
|
||||||
if(option && !this._selected_remote.some(o => o.value == newValueElement))
|
if(typeof this.select != "undefined")
|
||||||
{
|
{
|
||||||
this._selected_remote.push(option);
|
this.select.value = this.shoelaceValue ?? this.value;
|
||||||
|
this.select.requestUpdate("value");
|
||||||
}
|
}
|
||||||
this.requestUpdate();
|
this.requestUpdate("value");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user