Can you force "order" option to interpret and sort data as numeric rather than string?
Can you force "order" option to interpret and sort data as numeric rather than string?
![AdamCMP](https://secure.gravatar.com/avatar/1fb5272b1040a929ffe3e747bd4d3ab8/?default=https%3A%2F%2Fvanillicon.com%2F1fb5272b1040a929ffe3e747bd4d3ab8_200.png&rating=g&size=120)
My data (a list of IDs) is being read and sorted as strings. This results in order like:
1, 10, 11 ... 2, 20, 21 ... 3, 30, etc.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @AdamCMP ,
DataTables normally detects the type if the column is all numbers like that. It would be worth checking the data to make sure there's no non-numeric characters in there.
If it looks good, you can force the type with
columns.type
, and specifynum
.Cheers,
Colin