-
16 Aug 2010 1:04 AM #1
How to set NumberFormat for NumberField
How to set NumberFormat for NumberField
Hello.
Do you know how to set NumberFormat for NumberFields?
How could I change the decimal separator? I didn't find anything in the API.
I'm wondering why GXT don't use the GWT-NumberFormat..
In this example GXT displays another value then GWT (locale=de)
Thanks.Code:numberField = new NumberField(); double test = 12.6d; NumberFormat f = NumberFormat.getDecimalFormat(); Window.alert("ui="+f.format(test)); // Displays 12,6 numberField.setValue(test); // Displays 12.6
-
23 Aug 2010 3:54 PM #2
I had the same issue. To get it to correctly display the decimal separator, I found that the format had to be explicitly set on the number field.
So your example code would now be:
Code:numberField = new NumberField(); double test = 12.6d; NumberFormat f = NumberFormat.getDecimalFormat(); Window.alert("ui="+f.format(test)); // Displays 12,6 numberField.setFormat( NumberFormat.getDecimalFormat() ); numberField.setValue(test); // will display 12,6
Hope this fixes it for you.
Similar Threads
-
[2.0 rc2] bug in NumberField when set max min value can't type decimal value
By Webflash in forum Ext GWT: Bugs (2.x)Replies: 0Last Post: 2 Jul 2009, 7:02 AM -
How to set the length of a textfield or numberfield
By skbach in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 4 Aug 2008, 1:23 PM -
how to set numberfield max value dynamically
By mxu in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 18 Jan 2008, 4:12 PM


Reply With Quote