Using ExtJS4.1, I have floating point coming as JSON response. How can I format the floating value as 3 digits after decimal points. Find below the example. Please help.
enter code here
Example:
{
header: 'Total',
sortable: true,
dataIndex: 'total',
field: { xtype: 'numberfield' },
renderer: this.onRenderCell
}
onRenderCell : function(value, metaData, record, rowIndex,colIndex, store, view){
Ext.util.Format.numberRenderer(value,'0.000');
return value;
}
------------------------------------------------------------------------
You can use the number(v, format)
function, for example:
Ext.util.Format.number(1.23456, '0.000');
witch will return:
"1.235"
(The numberRenderer
witch you've tried returns a function)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With