change datatypes.xml

How do I change datatypes.xml. My 1000 formatting is without comma as thousand separator.
I have tried to create a datatypes.xml in the ClassPath Root of global.
But the result on web page is still with comma as thousand separator.
The same problem is with date. I want to use 09.03.2016
See attachment for my location of datatypes.xml.

Cuba Dev

Formats specified in datatypes.xml are used only in formatting methods without locale (e.g. Datatype.format(Object)).
UI components use methods with locale (Datatype.format(Object, Locale)), so formatting strings depend on current user locale and hence are defined separately - in the main message pack of your application. This is mentioned here: https://doc.cuba-platform.com/manual-6.0/datatype.html - see the bottom of the page.
So instead of creating your own datatypes.xml, locate the main message pack (e.g. modules\web\src\com\company\demo\web\messages.properties) and add desired formatting strings there:


dateFormat = dd.MM.yyyy
numberGroupingSeparator = ,

That did’t help me so mutch. Still stuck with integer presentet with comma as thousand separator.
I have added “numberGroupingSeparator =blank” in the messages.properties,
how do i put it into the formatter field of table, and how do i format the value entered by user?
Integer values shall allways be formatted as integer value whitout thousand separator.
I have tried to put a xml formatting tag in the date field. This works if i put the format as so:

<formatter class="com.haulmont.cuba.gui.components.formatters.DateFormatter" format="dd.MM.yyyy"></formatter> 



But this don’t make it localized, makes the format static.
If I put “numberGroupingSeparator” in the formatter field i get an exeption.
I’m stuck.

> I have added “numberGroupingSeparator =blank” in the messages.properties
"Blank" won’t work in properties file, try this:


numberGroupingSeparator=\u0020

> Integer values shall allways be formatted as integer value whitout thousand separator.
Then add:


integerFormat=0

Ok. but how do I use this properties in the fields?
Formatter requires a class.
The properties is not set by default.

> but how do I use this properties in the fields?
Normally you don’t have to. Formatting properties set in the main message pack are used by default throughout all UI components. If it doesn’t work for you, let’s find out why. Send me the following:

  • cuba.availableLocales, cuba.mainMessagePack properties from web-app.properties
  • what locale do you use (en, etc.)?
  • message.properties files in the package specified by the last entry in the cuba.mainMessagePack property

I think I found the problem. I tried to put the formatting properties inside the messages.properties under

com.company.produksjon.gui.ordre

.
I discovered that there is a messages.properties in the com.company.produksjon.gui folder of app-gui. If i put the formatting properties here it works.
So, to format integer, dates, etc in the GUI. Use the messages.properties file under

com.company.<projectname>.gui.messages.properties