mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
remove removing of empty description and label widgets
also make sure option.value is a string, as sl-select seems to use === to calculate matches so option with value 0 is not selected by a value of '0'
This commit is contained in:
parent
22f41e7cb4
commit
c251e2f185
@ -151,6 +151,19 @@ export const Et2widgetWithSelectMixin = dedupeMixin((superclass) =>
|
||||
this.__select_options = cleanSelectOptions(new_options);
|
||||
|
||||
this.requestUpdate("select_options", old_options);
|
||||
|
||||
// if single selection and value does not match an option, use the first option
|
||||
let first_option;
|
||||
if (!this.multiple && !this.empty_label && !this.__select_options.filter(option => {
|
||||
if (typeof first_option === 'undefined')
|
||||
{
|
||||
first_option = option;
|
||||
}
|
||||
return option.value === this.value;
|
||||
}).length && typeof first_option !== 'undefined')
|
||||
{
|
||||
this.set_value(first_option.value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -240,6 +240,14 @@ export function cleanSelectOptions(options : SelectOption[] | string[] | object)
|
||||
}
|
||||
else
|
||||
{
|
||||
// make sure value is a string
|
||||
options.forEach(option =>
|
||||
{
|
||||
if (typeof option.value !== 'string')
|
||||
{
|
||||
option.value = option.value.toString();
|
||||
}
|
||||
})
|
||||
fixed_options = options;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user