German number formatting without pattern

Tags: #<Tag:0x00007efc651cd460>

Hi,
I have been searching for a solution for some time now but unfortunately couldn’t find a way to just tell my grid to format numbers using a german format. I tried the language setting (documented here: https://handsontable.com/docs/internationalization-i18n/#demo) but I think it’s for ui strings only, right? I also tried the numericFormat property for cells, which I am using already for currency and percentage, but I couldn’t manage to use the german culture for any unformatted number in any place in my dynamic sheet. We have to build kind of a simple Excel clone for our customer.
Thanks in advance for any help.

Hi @ole.cordsen

Did you try the numeric demo in our documentation? You can test it here https://jsfiddle.net/by2h4f19/1/

I see that the latest version of the tutorial misses the language file (I’ve reported the bug) https://handsontable.com/docs/8.4.0/components/numbro/dist/languages.min.js so be sure to add it

Hi @aleksandra_budnik,
thanks for your reply. In the linked fiddle I would need the possibility to insert a number for example in the first column in german format. When I type “100,5” in the first column, “100,5” is preserved but I think it wouldn’t work in a formula, right? When I type “100,5” in the second column (type “numeric”) it gets converted to “100.5” without visible config. Is that done by the language file silently? Or am I wrong? It looks like a good step, because the library seems to accept the comma but in best case the german user would always see the comma (in editing mode too). The value should be a valid JavaScript number literal in the change handler though. Do you think that’s possible?

yes and no. If you call the numericFormat of the cell from the second column (Year) the value that is returned by the getCellMeta method is underfined.

However, if the pattern of numericFormat is not set by the programmer the default settings are applied. Here https://github.com/handsontable/handsontable/issues/4396 is the topic that mentions the change of the comma to a dot in numeric cells without the numericFormat defined.

Once you define the format it also formats formula results. Here an example https://jsfiddle.net/kev8fja1/6/

in best case the german user would always see the comma (in editing mode too)

If you hold a dot in the data you could do a replacement of the value programmatically. And I can help to share some approaches here but I would need to know what data format do you want to keep on the server and is there any other place that uses the data from Handsontable. Also, do you plan to export the data as a file or HTML

Yes, in my data I have a valid JS number literal. As we need to support language switching between german and english (and maybe more in future) I would like to keep the “normal” english number format with the dot as decimal separator. The data gets sent to our backend in an afterChange handler. Export as file or html is not needed.

OK, so you would need a custom editor to

Hi @ole.cordsen

how is the progress?

Hi @aleksandra_budnik, sorry for forgetting to answer. Unfortunately I had to try another library because of some missing points/bugs. I think it might have worked with the upcoming update including HyperFormula v1 but at this moment we cannot wait. Thanks again for your support and your great library.

Thank you for the update @ole.cordsen
If you’ll need me you know where to look for. :slight_smile:
I keep my fingers crossed for your project