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?

AdamCMPAdamCMP Posts: 1Questions: 1Answers: 0

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

Answers

  • colincolin Posts: 15,236Questions: 1Answers: 2,598
    Answer ✓

    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 specify num.

    Cheers,

    Colin

This discussion has been closed.