Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development | Spring 2019

## jQuery Plugin - Tablesorter

Query Tablesorter Plugin makes dealing with tables even easier!

    $(document).ready(function() {
       $("table.tablesorter").tablesorter({
        "theme": "blue",
        "widgets": [
            "zebra"
        ]
    });
    });

- Plain table: senate-plain.html
- Sortable table: senate-tablesorter.html
  - Javascript
    - jQuery (jquery.js)
    - jQuery Tablesorter Plugin (jquery.tablesorter.js)
  - CSS
    - Use the "blue" theme from the tablesorter plugin
  - Assign tables with classes
  - jQuery "ready" function

Data passed to the "tablesorter" plugin:

    {
        "theme": "blue",
        "widgets": [
            "zebra"
        ]
    }

Sortable table:

Tables are constructed with `thead` and `tbody`. Simply by giving them a `class="sortable"`, the jQuery Tablesorter Plugin makes them 'sortable' and 'striped':

Senate data used with permission from GovTrack.US.
Table sorting is achieved through jQuery and the jQuery Tablesorter Plugin

Copyright © David Heitmeyer