PDA

View Full Version : [CLOSED] Grid numbercolumn format with parentheses around negative numbers



jchau
Aug 27, 2014, 3:24 PM
In finance, negative numbers should have () around them instead of - sign. In .NET, it's easy to use a formatstring of "$#,##;($#,##)" to accomplish this. Is there an equivalent in ExtJS for format property of NumberColumn? It seems like NumberColumn uses Ext.util.Format.number in the backend, and that function doesn't seem to support the format string.



>> Ext.util.Format.number(-123.50, '$#,##;($#,##)')
"$-124;($#,##)"

Daniil
Aug 28, 2014, 8:12 AM
Hi @jchau,

It looks there is no such the possibility. You could extend/override Ext.util.Format's number method.

jchau
Aug 28, 2014, 12:15 PM
Ok, thanks for the update. We found another JS library for number formatting.

Daniil
Aug 28, 2014, 12:39 PM
Could you, please, share a link?

jchau
Aug 28, 2014, 1:18 PM
http://www.xaprb.com/blog/2007/06/19/javascript-number-formatting-library-updated/