Custom number format in Wijmo InputNumber

Posted by: tmurugasamy on 25 September 2017, 8:12 pm EST

  • Posted 25 September 2017, 8:12 pm EST

    How to use Custom number format in Wijmo InputNumber field?

  • Posted 26 September 2017, 3:27 am EST

    Hi,

    Could you please let us know what format you would like to apply for InputNumber control and technology you are using?

    Thanks,

    Manish Kumar Gupta

  • Posted 26 September 2017, 3:55 pm EST

    Hi,

    I am using Angular 2.

    • “Here’s my requirements:”

    If i enter a number 58956.2500 in the input fields, it should format the number as 8,158,956.25(no trailing zeros with comma separator)

  • Posted 29 September 2017, 1:14 am EST

    Hi,

    This requires further investigation. Hence, this issue has been forwarded to concerned team for further investigation with internal tracking id 289382.

    Thanks,

    Manish Kumar Gupta

  • Posted 8 November 2017, 4:24 am EST

    Hi,

    We are sorry for the delayed response.

    You may use InputNumber with format g. Please refer to the fiddle(http://jsfiddle.net/mkgupta911/bdq8op8g/11/) for the same.

    The problem with format “g” is that this does not allow to enter 567.004 in the control since “g” format removes the trailing 0 from value.

    Hence, this can be overcome by following, set the format of control to “g” and focus set it to “n” and revert back to “g” on lostFocus event.

    ~Manish

  • Posted 1 December 2017, 1:24 pm EST

    Hi Manish,

    there is a bug on it.

    e.g.

    <wj-input-number [(value)]=“price”

    [step]=“0.01”

    [format]=“‘g6’”

    [isRequired]=“true”>

    if I type 35.450000 it would display as 34.5 => nice

    if I try typing 35.05 it would not accept the input. the workaround is…type 35.5 move left arrow and add the 0 before the 5…

    can this be sorted asap?

    Regards,

  • Posted 6 January 2018, 9:08 am EST

    HI,

    Sorry for the late reply.

    The ‘g’ format removes trailing zeros, so if you use it in an InputNumber control you will not be able to type values such as “1.002”. The zeros will be removed before you get to type the “2”.

    To the point, ‘g’ format is not very compatible with InputNumber.

    But if you want to edit that way (user may type trailing zeros, which are removed when the edits are committed), you should probably use a regular input element instead of an input number, and apply the format you want when the element loses focus.

    Or Go with

    Set the format of control to “g” and focus set it to “n” on gotFocus event and revert back to “g” on lostFocus event.

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels