1. #1
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    231
    Vote Rating
    2
    nicolabaldo is on a distinguished road

      0  

    Default number format

    number format


    I need to set decimal in this way:
    5,3 -> 5,30

    I try to use this code but the char '0' doesn't appear.

    Ext.override(Ext.form.NumberField, {
    setValue: function(v) {
    this.decimalSeparator= ',';
    if (v){
    v= v.toFixed(2);
    }
    return Ext.form.NumberField.superclass.setValue.call(this, v);
    }
    });

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,077
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Have a look at: Ext.util.Format.number

    Code:
    > val = 5.3;
    > fmtVal = Ext.util.Format.number(val, '0,000.00'); // see /i for local separators.
    ? 5.30
    Regards,
    Scott.

  3. #3
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    231
    Vote Rating
    2
    nicolabaldo is on a distinguished road

      0  

    Default


    Ok thanks!

  4. #4

  5. #5
    Sencha User
    Join Date
    Oct 2011
    Location
    indonesia
    Posts
    17
    Vote Rating
    0
    stoneboys is on a distinguished road

      0  

    Default


    Quote Originally Posted by scottmartin View Post
    Have a look at: Ext.util.Format.number

    Code:
    > val = 5.3;
    > fmtVal = Ext.util.Format.number(val, '0,000.00'); // see /i for local separators.
    ? 5.30
    Regards,
    Scott.
    Hi.. i use it with my local separator like ( '0.000,00/i' ) for ( 1.000,00 ) but its not work, what wrong?

  6. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,077
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Do you have a locale locale file that may be overriding thousandSeparator?

    Scott.