You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When binding a boolean field to a vaadin-select using the following construct
<vaadin-select${field(model.mode)}.renderer="${guard([], () => (root: HTMLElement) => render(html` <vaadin-list-box> <vaadin-item value="true">Description Text A</vaadin-item><vaadin-itemvalue="false">Description Text B</vaadin-item></vaadin-list-box>`, root))}"></vaadin-select>
the used BooleanModel will interpret every string that is not empty as true since Boolean() is used to convert the string back to a boolean.
Changing the false-item to an empty string as suggested by @Haprog doesn't work either. Writing back into the model works but reading from the model will result in an empty select element.
Using a checkbox or radio buttons in this case is not a viable solution in my case since i have longer labels to describe the two options which would either confuse the user (checkbox) or waste ui space (radiobuttons)
Expected behavior
It is expected that if the property value is trueoption A of the select element is shown and if the value is falseoption B is shown.
When changing the select element to option A the property value should be change to true and if changed to option B the value should be false.
Actual behavior
When changing the select element to option A the property value will be set to true and if changed to option B the value is set to false. But when reading from the model the select element becomes empty for every property value.
Versions:
Vaadin 22.0.2
Java: 16
The text was updated successfully, but these errors were encountered:
It's a bug in the BooleanModel fromString, we should fix that and possibly open a static property that users can override themselves to customize the behavior.
Description of the bug
When binding a boolean field to a vaadin-select using the following construct
the used BooleanModel will interpret every string that is not empty as true since Boolean() is used to convert the string back to a boolean.
Changing the false-item to an empty string as suggested by @Haprog doesn't work either. Writing back into the model works but reading from the model will result in an empty select element.
Using a checkbox or radio buttons in this case is not a viable solution in my case since i have longer labels to describe the two options which would either confuse the user (checkbox) or waste ui space (radiobuttons)
Expected behavior
It is expected that if the property value is true option A of the select element is shown and if the value is false option B is shown.
When changing the select element to option A the property value should be change to true and if changed to option B the value should be false.
Actual behavior
When changing the select element to option A the property value will be set to true and if changed to option B the value is set to false. But when reading from the model the select element becomes empty for every property value.
Versions:
Vaadin 22.0.2
Java: 16
The text was updated successfully, but these errors were encountered: