-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I don't know if it's a bug or a change that has been made on purpose, so I first ask here.
In my application I have several Decimalboxes where I need that ',' and '.' (comma and point) have the same behavior.
Back in ZK3.6 I redefined my own Decimalbox class in lang-addon.xml and override the
protected Object coerceFromString(String value)
just for the sake of it, here it is a sample code:
<zscript> public class MyDecimalbox extends org.zkoss.zul.Decimalbox { public MyDecimalbox() { System.out.println("Constructor called!"); } protected Object coerceFromString(String value) { System.out.println("NEVER CALLED!"); } } </zscript> <decimalbox use="MyDecimalbox" format="0.00"/>
Since 5.0.0, ZK introduces "Server+Client Fusion": http://books.zkoss.org/wiki/Small_Talks/2009/July/ZK_5.0_and_Server%2BClient_Fusion
I think that Decimalbox check format on client-side not server-side.
If you want to change the value before Decimalbox apply it, you can use client-size programming: http://books.zkoss.org/wiki/ZK%20Client-side%20Reference/General%20Control/Widget%20Customization
I write a example:
<zk xmlns:w="http://www.zkoss.org/2005/zk/client"> <decimalbox format="0.00"> <attribute w:name="coerceFromString_"> function (value) { console.log(value); return this.$coerceFromString_(value); } </attribute> </decimalbox> </zk>
Thank you, works great!
Suggestion: shouldn't the coerceFromString Java method be removed as ZK is not using it?
Thank you again,
bye
Asked: 2012-06-01 13:34:13 +0800
Seen: 171 times
Last updated: Jun 07 '12