mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-16 18:31:26 +01:00
Select bugfixes
- If value is changed because it's not a valid option, that might need a refresh - If empty_label is changed, we need to update that
This commit is contained in:
parent
2a280c66cf
commit
0ca7508cd3
@ -216,8 +216,10 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
||||
// value not in options --> use empty_label, if exists, or first option otherwise
|
||||
if(this.select_options.filter((option) => valueArray.find(val => val == option.value)).length === 0)
|
||||
{
|
||||
let oldValue = this.value;
|
||||
this.value = this.empty_label ? "" : "" + this.select_options[0]?.value;
|
||||
// ""+ to cast value of 0 to "0", to not replace with ""
|
||||
this.requestUpdate("value", oldValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ export const Et2widgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
|
||||
}
|
||||
|
||||
// Add in actual option tags to the DOM based on the new select_options
|
||||
if(changedProperties.has('select_options'))
|
||||
if(changedProperties.has('select_options') || changedProperties.has("empty_label"))
|
||||
{
|
||||
// Add in options as children to the target node
|
||||
if(this._optionTargetNode)
|
||||
|
Loading…
Reference in New Issue
Block a user