nicolaskruchten / pivottable

Open-source Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop.
https://pivottable.js.org/
MIT License
4.35k stars 1.08k forks source link

Sum problem #1281

Open markdeca opened 3 years ago

markdeca commented 3 years ago

Hello, I noticed that when I use sum function the digits after the comma (that in my case represent decimals) are not loaded so result isn't correct. If I change my values in the table, from which I load data, putting a dot instead of a comma, then it works. I use Italian localization and I tried to look at the code too without success. Maybe I should look elsewhere or probably I'm doing something wrong, but I can't figure it out.

Could you help me out? Thanks.

markdeca commented 3 years ago

I managed to find a solution anyway so I changed this string: return this.sum += parseFloat(record[attr]); to: return this.sum += parseFloat(record[attr].replace(",", ".")); and now seems to work smoothly.