-
Bug
-
Resolution: Fixed
-
Major
-
5.4.7
-
-
Empty show more show less
-
Saigon 73
-
5
Vaadin applies StringToDoubleConverter by default for Double properties.
This converter internally uses a default NumberFormat instance with maximumFractionDigits set to 3.
When applying the new value back on the server-side, Vaadin's AbstractTextField does this thing of beauty:
T doubleConvertedFieldValue = convertFromModel(convertToModel(newFieldValue))
This immediately updates the presentation to however this value would be rendered at a later point. I haven't dug yet why the approximated presentation value bubbles back to the model though.
Even then, our forms are rightfully immediate, so we don't want to show a rounded value when user blurs the field (locale-dependent formatting still welcome).
Proposal
I suggest we bridge the gap and override StringToDoubleConverter#getFormat() and #setMaximumFractionDigits() to whatever more meaningful, then assign it automatically from the TextFieldFactory when property type is Double.
Original report
I use magnolia 5.4.7 and try to define a filed with type Double or Decimal in my app to save google maps coordinates in yaml:
- name: latitude class: info.magnolia.ui.form.field.definition.TextFieldDefinition type: Double
the app does work, but I only can keep 3 digital after point no matter what I enter. For example, I entere "10.123456789", after the field lost focus, it will be show as 10.123. Even it displayed as "10.123456789" after save and check the value again it saved as 10.123. How I can save all digital as double?
via Magnolia forums: TextFieldDefinition with type "Double" or "Decimal" only can keep 3 digitals after point
- relates to
-
MGNLUI-6896 TextFieldDefinition with "Double" or "Decimal" type should not round input values
- Closed