Results 1 to 3 of 3

Thread: Force 2 decimals to show in a Number Field?

  1. #1
    Sencha Premium Member
    Join Date
    Jan 2012
    Vote Rating

    Default Force 2 decimals to show in a Number Field?

    Is there an easy way to force 2 decimal places to always show in a Number Field or any other component in Architect? If I set the decimalPrecision to 2 it does not display 2 decimals for numbers like 0 or 1.5. I want all numbers to always show 2 decimals and display as 0.00 and 1.50.

    I have looked at these 2 forum posts but they do not work very well in Sencha Architect.

    To give you more details, I am creating a simple order and customer history form and have several numeric fields that need to display as a currency amount. Right now it looks odd to see the numbers with various decimal place lengths.

    Here is an example of how it currently looks setting the Number Field's decimalPrecision to 2.

    Order Total: 153.1
    Shipping: 25
    Sales Tax: 12.7
    Subtotal: 190.8

    However, what I need is this.

    Order Total: 153.10
    Shipping: 25.00
    Sales Tax: 12.70
    Subtotal: 190.80

    It seems so simple and standard that I cannot believe this feature does not exist in Architect. Am I missing something in the Config?


  2. #2
    Sencha Premium Member
    Join Date
    Jun 2013
    Vote Rating


    I also need that !

  3. #3
    Ext JS Premium Member tangix's Avatar
    Join Date
    Mar 2010
    Stockholm, Sweden
    Vote Rating


    Quick and dirty would be to add the NumberField to the project and just take the UX code and add as an override (in this example, you need to change the references to Ext.ux.form.NumericField in the code).
    This does not solve the 2 decimal problem, but fixes the currency symbol things at least.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts