Formatting currency/decimal fields when in edit mode
New DiscussionI'm displaying a number of currency (decimal) fields in a grid. I'm using the format "C" in order to display the values as localised currencies (56.7 is displayed as "$56.70"), and this works fine.
In edit mode, however, it is a different matter.
When I tab into the field, it shows all of the zeros/decimal places in the number, so 56.7 is displayed as "56.7000000000000000". Not at all a practical way to edit the data.
What I would like is for it to display data while in edit mode dependent on the current value.
For example:
10 would display as "10.00"
23.4 would display as "23.40"
45.67 would display as "45.67"
12.345 would display as "12.345"
I had a play with the standard maskInput options, but none of them seem to suit my needs.
I suspect there is no easy way of doing this, and will probably have to format the data myself somehow, but I have no idea where I have to do this. If someone can tell me how to do this, or at least point me in the right direction, I'd much appreciate it.
thanks.
—Edited to fix up formatting issues (Google Chrome browser doesnt work quite right with this forum…)—