How To

  • Multi-column sorting : add “tablesorter” class to the required table
  • Disable sorting from particular column : add “sortless” class to the required TH column within THEAD tag.
  • Sort multiple columns simultaneously by holding down the shift key and clicking a second, third or even fourth column header!
  • Cross-browser support : IE 6.0+, FF 2+, Safari 2.0+, Opera 9.0+

IMPORTANT

  1. THEAD and TBODY tags are compulsory in the desired table, otherwise this plugin will not work.
  2. Add tablesorter class in the desired TABLE tag.
  3. For column heading, use TH tag within THEAD tag.
  4. If you want to exclude a particular column, add sortless class to that TH tag.

Initial Sorting

You can add initial sorting by adding instructions in the CLASS attribute of the HTML table in the format:
{sortlist: [[columnIndex, sortDirection], … ]}
where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: {sortlist: [[0,0],[1,0]]}

Example: <table id=”myTable” class=”tablesorter {sortlist: [[2,0]]}”>

Comments are closed !