Can anybody tell me how to round a float value in extjs4.1? For example, if I have the value 24.536, I need to round it to 24.54. If I have 24.534, I need to round it to 24.53.
Asked
Active
Viewed 5,985 times
1 Answers
3
If you realy want round number, use it:
number = Math.round(number * 100) / 100;
Extend
If you want show rounded number - you may use ExtJs numbe format tools. Try this:
//Set these once, right after Ext.onReady
Ext.util.Format.thousandSeparator = ' ';
Ext.util.Format.decimalSeparator = '.';
//Then this should round your number correctly:
Ext.util.Format.number(12345.00, '0,000.00'); //output 12 345.67

Ludovic Feltz
- 11,416
- 4
- 47
- 63

Eugene
- 1,899
- 1
- 13
- 10
-
thanks for your help want to display two digit floating number .if it is 0 its not displaying can u tell how to display two digit floating no – mohan May 09 '13 at 09:36