How to avoid converting comma to decimal on data intersertion

Tags: #<Tag:0x00007f8b266f8728>

I cam across below post on the same topic, but I am not able to figure out how to write that renderer -

I tried adding renderer for the columns when data is numeric -

c.type = ‘numeric’;
c.numericFormat = { pattern: ‘0,0’ }
c.renderer = function(instance, td, row, col, prop, value, cellProperties) {

}

but in above renderer, when the value comes its already converted -
e.g.
4,500 inserted value shows up as - 4.5
5,000 inserted value shows up as - 5

is there any way to not apply this auto formatting/underlying value change automatically and keep the value as is.

Hi @jpatel

so to confirm you’d like to pass a comma that will just be removed when cell editor is closed, just like the Author of that post

  • enter a number with commas, say 100,000 and it is parsed to 100000 (100,000)

Is that correct?

yes. thats correct.

100,000 => 100,000
10.50 => 10.5
23,400.7 => 23,400.7
5000 => 5,000

In those four examples we (in 0,0.0 format) support 2 of them: 5000 > 5,000 and 10.50 > 10.5. Demo for tests https://jsfiddle.net/sj9x05k8/
Everything that contains a comma is tread as a string. We do not have a numericFormat that would meet all those requirements. So in this case, I recommend checking those threads

And if you have a higher support plan I can also recommend writing to support@handsontable.com and request help in constructing the custom logic by providing the full list of requirements for the numericFormat.