-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello
I have a decimalbox with format:
<decimalbox id="decimalbox1" format="#,##0.##" />
For example, it renders numbers like this:
100.11 --> 100.11
100.10 --> 100.1
100.00 --> 100
What if I want to always format at 2 dot decimals?
I cannot find a way to do it, neither a property or constraint.
How could it be done?
Thanks
Best regards
Gianluca Bonetti
You can create a lang-addon.xml file with this content:
<language-addon> <component> <component-name>decimalbox</component-name> <extends>decimalbox</extends> <property> <property-name>format</property-name> <property-value>#,##0.##</property-value> </property> </component> <language-addon>
And in your zk.xml configure it:
<language-config> <addon-uri>/WEB-INF/lang-addon.xml</addon-uri> </language-config>
That's it.
Regards,
It's missunderstood. The lang-add-on way is not working for the needed result.
Gianluca will force to fixed two digits.
now rendering
100.11 --> 100.11
100.10 --> 100.1
100.00 --> 100
new rendering
100.11 --> 100.11
100.10 --> 100.10
100.00 --> 100,00
Hello
Thanks Felipe and Terry
The lang-addon.xml tip (I didn't know yet) has been useful anyway.
This way I put the format property on every decimalbox without need to specify each time.
I discovered looking around that the correct format string is "#,##0.00"
"#,##0.##" shows decimal part without ending zeroes.
"#,##0.00" shows decimal part always, even if is ends with zeroes.
Thanks everybody!
Bye
Gianluca Bonetti
Great Filipe and Gianluca.
I implemented in this way yet. :-)
Asked: 2009-11-26 04:40:39 +0800
Seen: 971 times
Last updated: Dec 02 '09