views:

442

answers:

3

i have a column that was pure text and the sorting worked fine but when i cahnge the column data to html regular links, the sorting seems quite random and broken. I couldn't find any other documentation on this issue on the site.

http://www.datatables.net/usage/features

any suggestions?

A: 

I would check the source of the plugin, and see if it's sorting on something like this

var sortText = $(this).html();

and change the html() method to text(). This will strip out all tags and sort it on the text node only.

alex
+2  A: 

Use sSortDataType and sType (with value html) to notate the column as containing HTML and remove it prior to sorting. Docs on the Columns page.

tvanfosson
A: 

It sounds like the table is being sorted on the literal HTML strings, rather than the text. I haven't used that plugin but there is probably a way to override the default sorting method.

If not, give TableSorter a try, because it does this.

DisgruntledGoat