Sorting strings

Sorting strings

KrlinhosKrlinhos Posts: 8Questions: 0Answers: 0
edited July 2013 in General
I have a column with data string. This strings are code like PR/1 or PR/31. The problem is when i sort the column, I want something like this:


PR/1
PR/2
...
PR/10

But actually I can get only this:

PR/1
PR/10
PR/11
...
PR/2

How can I change the sort method??

Any solution?

thanks a lot!

Replies

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Try the natural sorting plug-in: http://datatables.net/plug-ins/sorting#natrual

    Allan
  • KrlinhosKrlinhos Posts: 8Questions: 0Answers: 0
    Thanks Allan, but I have to put the code for function sorting in a new js file. And then how can I use this function in my table. There is a example in somewhere??
  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Example using sType to define what sorting to apply: http://datatables.net/release-datatables/examples/plug-ins/sorting_sType.html

    Allan
This discussion has been closed.