0

I want to format the numeric values like 1,23,456 and display the data in the Grid. I modified the Grid column renderer to return the string like I mentioned above. Below is the renderer code:

String value = NumberFormat.getFormat("#,##,##0").format(123456d);

But am getting the value like following 123,456. Could someone help me to resolve this issue.

Thanks in advance.

  • according to NumberFormat GWT doc http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/i18n/client/NumberFormat.html : ',' is a grouping pattern. Maybe you could try with ';' – willome Feb 11 '13 at 15:58

1 Answers1

1

The method format only allows one grouping size:

protected void format(boolean isNegative, StringBuilder digits, int scale) {
...
    int currentGroupingSize = this.groupingSize;
...

So, when your format pattern is analized it takes the first grouping size.

For example, if we try

String value = NumberFormat.getFormat("#,###,#0").format(123456d);

we will get 12,34,56

Hope this helps.

Pablo Chvx
  • 1,809
  • 18
  • 31