Skip to content Skip to sidebar Skip to footer

Sort Table By Class In TH

I have a table with 10 columns, every column has a different class, for example the last has: data-tot How to sort the table by this class and in descending order? A full jsFiddle

Solution 1:

SOLUTION

Use the code below to sort table by column specified by jQuery selector .data-tot in descending order.

$('#myTable').DataTable().column('.data-tot').order('desc').draw();

See columns().order() for more details.

DEMO

See updated jsFiddle for code and demonstration.


Solution 2:

As from you link you are not using DataTables. you need to simple give an id to you table. And the rest will do DataTables.
Here is updated link


Post a Comment for "Sort Table By Class In TH"