PDA

View Full Version : How to display two digit floating point no for rounding the value in extjs



vijayakumar84
9 May 2013, 1:51 AM
Hi
can anybody tell How to display two digit floating point no for rounding the value.If no is 245.69782 need to display 245.70 .In java script there is fixed() method is available

Thanks

droessner
9 May 2013, 4:53 AM
This will return '245.70'


Ext.Number.toFixed(245.69782, 2)

richardvd
9 May 2013, 7:09 AM
Or if you need localized output, use Ext.util.Format (http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.util.Format).

include your locale, e.g. for 'nl':

<script src="http://cdn.sencha.com/ext/gpl/4.2.0/locale/ext-lang-nl.js"></script>


Ext.util.Format.number(245.69782, "0,000.00");

This will return '245,70'.