Formating numbers
Sometimes, you need to display numbers with distinct formats
If you need set a fixed number of decimal places, you can toggle JS mode and then usd
toFixed
method from Javascript.The variable/data type should be
number
, otherwise the method toFixed
will not be available.
Example on adding decimal places on number display
Once you are in Javascript mode, you can always replace characters, like that:
$.salary.toFixed(2).replace(/\./g, ',')
$.salary.toLocaleString("pt-BR", {style: "currency", currency: "BRL"})
// "R$ 12.000,00"
Last modified 1yr ago