olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.78k stars 821 forks source link

Comma as decimal separator doesn't work as intended, using editor = 'input' for a column cell #4460

Closed AndrasEliassen closed 7 months ago

AndrasEliassen commented 7 months ago

Describe the bug Tabulator doesn't seem to allow using comma as the decimal separator, as we usually do in our part of the world (nordic countries)

I instantiate the column with instructions that the comma should be the decimal sign:

formatterParams: { decimal: ",", thousand: ".", symbol: "", symbolAfter: "", precision: 2 },

Tabulator Info 6.2.0

Working Example https://jsfiddle.net/iSolveIT/1qjds6gk/2/

To Reproduce A step by step guide to recreate the issue in the JS Fiddle or Codepen:

  1. Go to https://jsfiddle.net/iSolveIT/1qjds6gk/2/
  2. Click on a debit or credit cell
  3. Write some decimal value into the cell, using comma as the decimal separator
  4. Press TAB and see the error as the value will change to "[something],00"

Expected behavior When instructing the column to use comma as decimal separator, the comma should work as the decimal separator

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

olifolkerd commented 7 months ago

Hey @AndrasEliassen

There is a misunderstanding here. The formatter is purely display only and is completely unrelated to the editor. the formatter is doing its job as anticipated.

This issue you have here is that you are using a standard input editor which is just expecting a standard text string, therefor it is just treating it as a numeric value, which JavaScript is expecting standard numeric notation of a "." for the decimal separator.

You would need to use an Edit Mutator to translate your string into a number that JavaScript can understand.

Cheers

Oli :)