You can pass an alternate sort order as a second parameter. By default sort is ascending. To change this, set:
**Note:** If you are using the default CSS provided you'll need to reverse the class names that style the arrows.
Exclude columns or rows
For columns or rows that do not require sorting, you can add attribute data-sort-method='none' to a columns th or a tr element.
Override data that is sorted on
Sometimes text inside cells is not normalized. Using a data-sort attribute you can use optional data to sort on.
You can use a custom attribute (instead of data-sort) using the sortAttribute option:
Specify the sort method for a column
By adding a data-sort-method attribute to a table heading you can force Tablesort to use a specific sorting method rather than guessing it. The value of data-sort-method corresponds to the name of a sort function.
Specify which table heading row enables sorting
If you have two or more table heading rows you can specify the one that enables sorting by adding a data-sort-method='thead' attribute to desired <tr> element.
Tablesort supports two custom events beforeSort & afterSort.
Refresh sort on appended data
Tablesort supports sorting when new data has been added. Simply call the refresh method.
It is possible to automatically sort the table once you create a Tablesort instance by adding data-sort-default attribute.
Sorting by column keys
Sometimes, tables can have more complex column structures, especially when using colspans. In these cases, you can
explicitly connect a header to the cells in each row that it should sort by, by using the data-sort-column-key
This example sorts products by price, even though the prices are not in the same column as their header.
Out of stock
Add the styling from tablesort.css file to your CSS or roll with your own.