jQWidgets Forums

jQuery UI Widgets Forums Editors NumberInput Problem with european number display

This topic contains 6 replies, has 2 voices, and was last updated by  Klaus H 9 years, 5 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Problem with european number display #77527

    Klaus H
    Participant

    Hello,

    I have a problem with the jqxNumberInput using european style formatting (, = decimal separator, . = group separator)

    Setting the value from a number does not work properly then, especially if it is a negative number. If I set -1 as value for example, the result is “–1,00”

    I have prepared two fiddles that demonstrate the problem – in the second fiddle it also shows you that it ignores the decimal digits.

    http://jsfiddle.net/7s7nkyf5/
    http://jsfiddle.net/r5ooc9qs/

    I have found a solution that works with if I set decimal as string ‘-1,5’
    http://jsfiddle.net/6kg0bcqh/

    The same does not work with ‘-1’
    http://jsfiddle.net/jb1m2mqL/

    Could you please advise me what the correct way is to use jqxNumberInput with these separators for values with decimal digits and give me an example?

    Best Regards
    Klaus

    Problem with european number display #77553

    Peter Stoev
    Keymaster

    Hi Klaus,

    Numbers in Javascript are written with “.” decemal separator. However, when you put the widget to have “,” as decimal separator you should pass Strings like “-1,0”, “1,5”, etc. Ex: http://jsfiddle.net/xppkmqxs/ and http://jsfiddle.net/jseyevL0/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Problem with european number display #77555

    Klaus H
    Participant

    Hello Peter,

    thank you for the feedback. My understanding was the decimal parameter is always a number and the formatting is just the representation of the number and the controle does the formatting. I had the hunch earlier today that I have to set the number already formatted so I tried that and retrieve the number via decimal again – that returns me a real number which is fine and solves my problem. Thank you for the confirmation. 🙂

    Best Regards
    Klaus

    Problem with european number display #77564

    Klaus H
    Participant

    Hi,

    I have found another odd behaviour or maybe my interpretation of the decimal property is incorrect. Using your example of http://jsfiddle.net/xppkmqxs/ and trying to get the number for a calculation, i used $(“#jqxNumberInput”).jqxNumberInput(‘decimal’)); which always gives me the positive value (at least in my format). $(“#jqxNumberInput”).jqxNumberInput(‘getDecimal’)); works correctly. I thought they should give me the exact same result.

    So I use getDecimal and it’s fine, but is this behaviour intended?

    Best Regards
    Klaus

    Problem with european number display #77686

    Klaus H
    Participant

    Could anyone please verify the difference between decimal and getDecimal?

    Problem with european number display #77690

    Peter Stoev
    Keymaster

    Hi Klaus,

    The one is a property, the other is a method. Obviously, there is a difference. Otherwise, why there would be a method, if it returns the same as the property.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Problem with european number display #77692

    Klaus H
    Participant

    Hello Peter,

    yes, I see – I had only consulted the API and examples, in the documentation section it is explained better. I was confused because I can set the property with a negative value but can only get positive values via the property.

    Thanks 🙂

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.