Dash data table Numeric column - decimal places

I am trying to specify 2 digits after the decimal (2 decimal places) by using Format on a Numeric column, when I create a data table:

{‘name’:‘Price’, ‘id’:‘price’, ‘editable’:True, ‘type’:‘numeric’, ‘format’:Format(precision=2)}

When I enter the data in the table, I am able to enter a number with decimals e.g. 70.55. However, when I move the mouse to the next column, the figure gets rounded to 71. I would like it to show as 70.55 and not round up. How can I fix this ?

Thanks !

I was able to solve the above problem by introducing scheme=Scheme.fixed:

{‘name’:‘Price’, ‘id’:‘price’, ‘editable’:True, ‘type’:‘numeric’, ‘format’:Format(precision=2, scheme=Scheme.fixed)}

What does Scheme do exactly ? It is mentioned in the documentation but the description is not detailed. My guess is it fixes the data type and prevents conversion to another data type ?

1 Like