jQWidgets Forums

jQuery UI Widgets Forums Editors NumberInput cannot set negative value with fractional part

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • Yuri Antipin
    Participant

    Hi! When I override the decimalSeparator I cannot set negative value with fractional part via “setDecimal” method.

    My example:

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <title> </title>
            <link rel="stylesheet" href="styles/jqx.base.css"/>
    		<link rel="stylesheet" href="styles/jqx.energyblue.css"/>
            <script type="text/javascript" src="scripts/jquery-1.10.2.min.js"> </script>
    		<script type="text/javascript" src="scripts/jqxcore.js"> </script>
            <script type="text/javascript" src="scripts/jqxnumberinput.js"> </script>
            <script type="text/javascript">
                $(document).ready(function () {
    				$('#numberInput').jqxNumberInput({
    					height: 25,
    					width: 200,
    					inputMode: 'simple',
    					theme: 'energyblue',
    					decimalSeparator: ',',
    					groupSeparator: ' ',
    				});
    				$('#numberInput').jqxNumberInput('setDecimal', -1.25);
                });
            </script>
        </head>
        <body>
    		<div id="numberInput"></div>
        </body>
    </html>

    Best regards, Yuri Antipin


    Peter Stoev
    Keymaster

    Hi Yuri,

    It should ‘-1,25’ in case the separator is ‘,’, i.e $(‘#numberInput’).jqxNumberInput(‘setDecimal’, ‘-1,25’);

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Yuri Antipin
    Participant

    Hi Peter Stoev,

    In your documentation says that “setDecimal” function takes a numeric value.
    ‘-1,25’ is String
    -1.25 is Number


    Peter Stoev
    Keymaster

    Hi Yuri Antipin,

    It is not possible to set 1,25 as Number, right? By default it is Number, but due to the reason that your decimal separator is “,”, you can’t write 1,25 and run your app as it will throw a syntax error.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.