Sorting numeric values goes wrong with thousands seperator
Sorting numeric values goes wrong with thousands seperator
I have a table of 6 columns, the last 2 containing numeric values formatted like this:
<td class="sum number-align-right">{{ sac.sumhoursstu|number_format(2, ',', '.') }}</td>
The thousands seperator is European, for example 23.590,33
The automatic sorting in Datatables is treating this like a string. Setting column type { "type": "num-fmt" } does not work.
The output of the sorted column ASC is like this:
1.003,23
2.500,30
953,90
There are no empty values or string values in the column.
How can I get the sorting right?
Answers
You may just need to specify which version of the data DataTables will use for actions. Have you checked out https://datatables.net/manual/data/orthogonal-data? How you specify will depend on how you're populating your table.
Have you specified the
language.decimal
option for your DataTable configuration? Documentation for that is available here.Allan