Is it possible to change the decimal seperator of GXT Numberfield from point to comma? I searched and tried a lot, but can't find a solution.
When filling the form field of type "FloatField" with a number like 67,8 - the value of the field is switched to 67.8. So the field accecpts inputs with commas, but the NumberFormat to display it, is simply wrong. How can i change that?
Thanks in advance, David.
ok, nobody had an answer, but a colleague of me have had the same problem and solved it. So, if anyone in future will search for it, here is the answer:
You can make your own FloatField class and override the behavior. The class (in the simpliest form) would be like this:
package org.example.myforms
public class FloatField extends NumberField<Float> {
/**
* Constructor
*/
public FloatField() {
super(new NumberPropertyEditor.FloatPropertyEditor());
init();
}
private void init () {
// disply float values with comma as decimal seperator
String pattern = "0.0;";
super.setFormat(NumberFormat.getFormat(pattern));
}
}
To use this field e.g. in your *.ui.xml you have to import your myform
package:
<ui:UiBinder
...
xmlns:myform="urn:import:org.example.myforms"
>
Then you can use it:
<myform:FloatField ui:field="field_1" allowDecimals="true"/>