-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1) Decimalbox non updated with zk 6.5.2 on ipad (with zk 6.0.3.1 is ok)
2) Writing "456.78" or "456,78" and clicking on second decimalbox "lost" the decimal "." or "," and transforms on "45678"
Then, is not possible to update to 6.5.2 with this problem.
index.zul
<zk>
<window id="finestraIndex" title="Hello World!!" border="normal"
width="200px" closable="true" use="TestDecimalbox">
<label value="You are using: ${desktop.webApp.version}" />
<decimalbox id="decimal" value="123.45"></decimalbox>
<decimalbox id="decimal2" ></decimalbox>
</window>
</zk>
TestDecimalbox.java
import java.math.BigDecimal;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.ConventionWires;
import org.zkoss.zul.Decimalbox;
import org.zkoss.zul.Window;
@SuppressWarnings("serial")
public class TestDecimalbox extends Window implements
org.zkoss.zk.ui.ext.AfterCompose {
private Window finestraIndex;
private Decimalbox decimal;
public void onCreate$finestraIndex(Event event) {
decimal.setValue(new BigDecimal("125.76"));
}
public void afterCompose() {
ConventionWires.wireVariables(this, this);
ConventionWires.addForwards(this, this);
}
}
Best Regards
Pedro Gonzalez
It is recommended to always define a number format for your decimalbox, e.g.
<decimalbox format="##0.00" ...>
for a float with two significant digits. Additionally, you have to use the correct decimal point character depending on your browser's locale, usually "." or ",". To disallow the grouping character for the decimal box, add the following library property in your zk.xml
<library-property>
<name>org.zkoss.zk.ui.input.grouping.allowed</name>
<value>false</value>
</library-property>
Then you can only enter your decimal point character and not the grouping character anymore.
Hi clooka,
My solutions is to use a textbox and not decimalbox.
I use this class to format the numbers:
http://www.decorplanit.com/plugin/
My sample code:
..
... <window> Quantita: textbox id="quantita" cols="10" constraint="" maxlength="11" readonly="true" /> <script type="text/javascript">
zk.afterMount(function(){
if (zk.mounting !== false) {
zk.afterMount(arguments.callee);
return;
}
nDecList = jq("$nDecList").val();
jq("$quantita").autoNumeric('init', {aSep: '.', aDec:',', mDec: '3', vMin: '-999999999.99'});
jq("$importounitario").autoNumeric('init', {aSep: '.', aDec:',', mDec: nDecList , vMin: '-999999999.99'});
jq("$unitarioivato").autoNumeric('init', {aSep: '.', aDec:',', mDec: '4', vMin: '-999999999.99'});
jq("$sc1").autoNumeric('init', {aSep: '.', aDec:',', mDec: '2', vMin: '-999999999.99'});
jq("$sc2").autoNumeric('init', {aSep: '.', aDec:',', mDec: '2', vMin: '-999999999.99'});
jq("$sc3").autoNumeric('init', {aSep: '.', aDec:',', mDec: '2', vMin: '-999999999.99'});
jq("$sc4").autoNumeric('init', {aSep: '.', aDec:',', mDec: '2', vMin: '-999999999.99'});
jq("$provv_perc").autoNumeric('init', {aSep: '.', aDec:',', mDec: '2', vMin: '-999999999.99'});
jq("$totalenetto").autoNumeric('init', {aSep: '.', aDec:',', mDec: '2', vMin: '-999999999.99'});
jq("$totaleivato").autoNumeric('init', {aSep: '.', aDec:',', mDec: '2', vMin: '-999999999.99'});
});
</script>
</window> .. ...
Best regards
Pedro Gonzalez
Asked: 2013-04-05 13:51:06 +0800
Seen: 30 times
Last updated: Jan 17 '14