Soting not sorting data cells with links

Soting not sorting data cells with links

euangreeneuangreen Posts: 7Questions: 0Answers: 0
edited April 2009 in General
Hi, great plugin, have only scratched the surface of it's potential!

I've created a list, very standar two column layout. I've added sorting to the table but when I sort the data in the first column does not sort correctly. IN some of the cells of the first column there are hrefs, and it seems these get added to the top of the list, regardless of what the value within the href is.
At it's most basic here's what's happening, imagine each row is the contents of a table cell in the column

m
a
b
c
d

Is there a filter I have to apply to amke sure it ony reads the contents within the href tag?

Thanks for any help

Euan

Replies

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin
    Hi Euan,

    What you need to do is tell DataTables that that column should strip html tags before sorting. Here is the example: http://datatables.net/examples/example_html_sort.html

    One other thing, just from completeness I presume your html should be m?

    Allan
  • euangreeneuangreen Posts: 7Questions: 0Answers: 0
    Hi Allan,

    Thanks for that, just what I was looking for.

    Euan
  • zirconxzirconx Posts: 7Questions: 0Answers: 0
    I was looking to solve this same problem, just thought I would update this thread with the correct link. The one referenced above is broken.

    http://datatables.net/examples/advanced_init/html_sort.html
This discussion has been closed.