mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 19:33:54 +01:00
fix mixup of this.value, Lion this.modelValue and old get/set_value
causing eg. numeric values not to be cast to string and therefore not selecting their option
This commit is contained in:
parent
c251e2f185
commit
a9e180a9fb
@ -164,7 +164,12 @@ export class Et2Select extends Et2WithSearchMixin(Et2InvokerMixin(Et2WidgetWithS
|
||||
|
||||
set_value(val)
|
||||
{
|
||||
this.value = val;
|
||||
this.value = ""+val;
|
||||
}
|
||||
|
||||
getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,17 +128,6 @@ export const Et2widgetWithSelectMixin = dedupeMixin((superclass) =>
|
||||
return super.formatter(v);
|
||||
}
|
||||
|
||||
set_value(val)
|
||||
{
|
||||
let oldValue = this.modelValue;
|
||||
|
||||
// Make sure it's a string
|
||||
val = "" + val;
|
||||
|
||||
this.modelValue = val
|
||||
this.requestUpdate("value", oldValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the select options
|
||||
*
|
||||
@ -153,16 +142,9 @@ export const Et2widgetWithSelectMixin = dedupeMixin((superclass) =>
|
||||
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')
|
||||
if (!this.multiple && !this.empty_label && !this.__select_options.filter(option => option.value === this.value).length)
|
||||
{
|
||||
first_option = option;
|
||||
}
|
||||
return option.value === this.value;
|
||||
}).length && typeof first_option !== 'undefined')
|
||||
{
|
||||
this.set_value(first_option.value);
|
||||
this.value = this.__select_options[0].value;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user