How to make numerical sorting go 1-10, instead of 1, 10, 2, 3, 4, etc.
How to make numerical sorting go 1-10, instead of 1, 10, 2, 3, 4, etc.
emt
Posts: 46Questions: 10Answers: 0
in DataTables
Hey Allan, is it possible to change the way DT sorts items numerically? For example:
By default, numerical sorting in DT is set like this: 1, 10, 2, 3, 4, 5, 6, 7, 8, 9
My question is, how can I get DT to sort like this: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You have non-numeric data in the column, which is why DataTables is string sorting the column.
I think in this case, given the data, the natural sorting plug-in is probably the best solution.
Allan