Default number format in BigDecimalField and NumberField should be "#.##"

NumberField and BigDecimalField have a default format of “#.#”. As the Formatting is not exposed atleast there should be an options to select the number of decimal spaces because 2 decimal places is the most used format than the one.

Maybe this helps you…
https://vaadin.com/forum/thread/18110476/18112102

If you are using binder the simplest solution is to set the scale when you are getting the BigDecimal field of the object like this:

binder.forField(priceField)
.bind(
p → p.getPrice().setScale(2, RoundingMode.HALF_UP),
ProductPrintDto::setPrice
);
This works perfect for version 24.8.3 and the field displays two digits after the comma
{D63AC816-CEEF-459E-A49D-BE0B8707F384}

1 Like