1

ipad decimalbox zk 6.5.2

asked 2013-04-05 13:51:06 +0800

pymsoft gravatar image pymsoft
133 5

updated 2013-04-08 10:44:26 +0800

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

delete flag offensive retag edit

3 Answers

Sort by » oldest newest most voted
0

answered 2013-04-08 12:04:39 +0800

Matze2 gravatar image Matze2
773 7

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.

link publish delete flag offensive edit

Comments

Hi Matze2, thanks for your response. The problem remains (testing with ipad), Testing with pc (chrome, FF) is ok.

pymsoft ( 2013-04-08 12:45:31 +0800 )edit

So both cases "456.78" or "456,78" end up with "45678"? Indeed, that's strange. What does your locale say (add ${desktop.execution.nativeRequest.locale} to your ZUL page)?

Matze2 ( 2013-04-08 13:39:11 +0800 )edit

Yes, in both cases are without decimals, but is not the problem too big. The really problem is that in PC I see 125,76 (from decimal setValue, but not in iPad/Android) Locale in iPad is: it_IT

pymsoft ( 2013-04-08 16:59:49 +0800 )edit

Strange. I would file an issue in ZK tracker.

Matze2 ( 2013-04-08 19:33:10 +0800 )edit

Thank you.

pymsoft ( 2013-04-09 15:12:03 +0800 )edit
0

answered 2013-12-18 21:14:19 +0800

clooka gravatar image clooka
0

Anyone knows a solution?

link publish delete flag offensive edit
0

answered 2014-01-17 12:30:50 +0800

pymsoft gravatar image pymsoft
133 5

updated 2014-01-17 12:33:35 +0800

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

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-04-05 13:51:06 +0800

Seen: 30 times

Last updated: Jan 17 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More