Sorting with large numbers

Sorting with large numbers

ingvaringvar Posts: 2Questions: 1Answers: 0

Hi :smile:
I have tables with large numbers and have a problem with sorting. Using version 1.10.16.

Sorting this list with a thousand separator and using columnDefs: [ { "type": "num-fmt", targets: 0 } - no problem
1.800
1.800
1.800
160.000
160.000
180.000
180.000
180.000
180.000

Sorting larger numbers with no format - no problem
18000
18000
18000
1600000
1600000
1800000
1800000
1800000
1800000

Sorting larger numbers with thousands separators, I get this.
1.800.000
18.000
1.600.000
18.000
1.800.000
18.000
1.600.000
1.800.000
1.800.000

Still using columnDefs: [ { "type": "num-fmt", targets: 0 }
There is no html in the columns, only the number with the thousand separators.

Can someone provide me with some information or help on this matter.

Thanks in advance, Ingvar

Answers

  • ingvaringvar Posts: 2Questions: 1Answers: 0

    I see that "Supported built-in thousands separators are ' and ,." in https://datatables.net/reference/option/columns.type

    Changing the project culture so the format has "," instead of "." for a thousand separator makes the sorting correct on large numbers.

    So, any workaround to make the sorting work with "." as a separator?

This discussion has been closed.