Sorted by integer number

Sorted by integer number

alexdiazalexdiaz Posts: 2Questions: 0Answers: 0
edited October 2010 in TableTools
Hi,

I'm really happy to use this excellent tool!... However, I'm trying to make a sort by integer number without successful results. I mean, my table should be listed in the following order: 1,2,3,4,5,6,7,8,9,10,11,12... instead of 1,10,11,12,2,3,4,5,6,7,8,9...

How can I fix this?

Thank you...

Replies

  • usmanusman Posts: 2Questions: 0Answers: 0
    for me also got the same error before, i my case i am using the jsp page using structs tags. i created a integer value in the scriptlet and place in the td. then my problem is cleared.
  • alexdiazalexdiaz Posts: 2Questions: 0Answers: 0
    Thanks usman... I'm not sure I've understood well. However, I guess you've added a kind of consecutive number as new field?... In Mysql/PHP I've the possibility to add a 'zero' before first unity (01, 02, 03...) but it isn't a good solution... So, any idea to fix this sort from the JS?
  • lleveringllevering Posts: 12Questions: 0Answers: 0
    As long as you don't have non-numeric chars in your table cells, you find the solution in this thread:
    http://datatables.net/forums/comments.php?DiscussionID=3010&page=1
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    And if you do have non-numeric data in the string, you can use this plug-in to remove it for the sort: http://datatables.net/plug-ins/sorting#formatted_numbers .

    Allan
This discussion has been closed.