-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Subject is the question.
I mean the right place is the lang-addon.xml
lang-addon.xml
<language-addon> . . . <!-- ====================================================== --> <!-- Define properties for commonly used components --> <!-- ====================================================== --> <component> <component-name>decimalbox</component-name> <extends>decimalbox</extends> <property> <property-name>format</property-name> <property-value>#,##0.00</property-value> </property> </component> </language-addon>
zk.xml
. . . <!-- ========================================================== --> <!-- Path to the character set and sizes --> <!-- Zkoss configuration file --> <!-- Custom components are declared here --> <!-- ========================================================== --> <language-config> <addon-uri>/WEB-INF/lang-addon.xml</addon-uri> </language-config>
best
Stephan
Thanks, Stephan.
But here is the strange thing with attribute "format"
decimailbox without specified format. It takes only comma as decimal separator, but always shows validation error message, like it wants me to write dot instead of comma. But it does not allow me to write dot - only comma. Regardless to validation errror message, this decimal box loads correct value to binded property, ex:
<decimalbox value="@{myController.decimalValue}"/>
<decimalbox format="#,##0.00" value="@{myController.decimalValue}"/>
It seems like some kind of bug.
Hmmm, i do not believe that's a bug. Seems that's a normal behaviour from SUN's DecimalFormatter class.
I remember that for a few months here in the forum are a thread about that. Someone means that for such a purpose you must rewritten the decimalbox.
Have a look on searching the thread.
* @see <a href="http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html">Java Tutorial</a> * @see NumberFormat * @see DecimalFormatSymbols * @see ParsePosition * @version 1.88 06/26/06 * @author Mark Davis * @author Alan Liu */ public class DecimalFormat extends NumberFormat {
best
Stephan
Hi, Stephan.
I think the bug is when decimal box allows only comma as decimal separator, but alerts with validattion error message if I specify comma-separated float value. Ths is first case in my previous post (without format specified). This happens only in ZK 5.0.3 , but with 3.6 issue is not reproduced.
I had also bad experiences with decimalbox without format. The behavior seems unpredictable to me.
I can only recommend to give a format attribute.
Regarding the decimal separator character: as far as I know, it depends on the locale and not on the given decimal format.
if you switch your browser to English ("en-us", for example), then you should get a decimal point.
Hi all,
I second Stephan's and Matze's comment. Using comma as decimal separator is defined by Sun's spec.
In addition, you can try to use setPreferredLocale to set your locale to English.
Regards,
Simon
Asked: 2010-07-01 14:17:18 +0800
Seen: 942 times
Last updated: Nov 18 '11