To Top

TableSorter – jQuery plugin

TableSorter – jQuery plugin

tablesorter is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell. It has many useful features including:

  • Multi-column sorting
  • Parsers for sorting text, URIs, integers, currency, floats, IP addresses, dates (ISO, long and short formats), time. Add your own easily
  • Support for ROWSPAN and COLSPAN on TH elements
  • Support secondary “hidden” sorting (e.g., maintain alphabetical sort when sorting on other criteria)
  • Extensibility via widget system
  • Cross-browser: IE 6.0+, FF 2+, Safari 2.0+, Opera 9.0+
  • Small code size

Getting started

To use the tablesorter plugin, include the jQuery library and the tablesorter plugin inside the tag of your HTML document:

tablesorter works on standard HTML tables. You must include THEAD and TBODY tags:

Last Name First Name Email Due Web Site
Smith John $50.00
Bach Frank $50.00
Doe Jason $100.00
Conway Tim $50.00

Start by telling tablesorter to sort your table when the document is loaded:


Click on the headers and you’ll see that your table is now sortable! You can also pass in configuration options when you initialize the table. This tells tablesorter to sort on the first and second column in ascending order.

$("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} );

Note: tablesorter will auto-detect most data types including numbers, dates, ip-adresses


More inSplashnology

Privacy Preference Center