Order 1,2,3 not 1,10,11

Order 1,2,3 not 1,10,11

shinokadashinokada Posts: 4Questions: 0Answers: 0
edited December 2009 in General
I have data output order by id, 1,2,3 etc.

However when I add DataTables, the order becomes 1,10,11, 12 etc.

How can I make it in order by 1, 2,3 ..?

Thanks in advance.

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Hi shinokada,

    Your example of it not working is actually numeric ( ;-) ), but I guess it would then go on something like 1, 10, 11, 12, 2, 21 etc. What this means is that the data type detection in DataTables has encountered something which is non-numeric in the cell. This could be a character or even white space. I'd suggest removing all characters which are not "[0-9].\-" and that should do the trick. You can see an example of this working on the fourth column here: http://datatables.net/

    Regards,
    Allan
This discussion has been closed.