jQuery plugin: Tablesorter 2.0 - jQuery UITheme Widget (jQuery UI)

# tablesorter

## jQuery UITheme Widget (jQuery UI)

### Flexible client-side table sorting

Back to documentation

NOTE!

- In v2.19.0, this widget allows dynamic changing of themes; including switching from jQuery UI or Bootstrap to any other theme. To change a theme, do the following:

      var $table = $('table');
      $table[0].config.theme = 'grey';
      $table.trigger('applyWidgets');

  To see this work, check out the scroller widget demo.
- As of tablesorter version 2.9+, this widget can no longer be applied to versions of tablesorter prior to version 2.8.
- You will need to modify the `headerTemplate` option to include the bootstrap icon! See the example in the code (v2.7).
- The original "widgetUitheme" option has been replaced by "widgetOptions.uitheme". See the javascript block below for more details (v2.1).
- In tablesorter v2.4, the `uitheme` option has changed to indicate the theme instead of an array of icons to use:
  - All theme class names are now contained within `$.tablesorter.themes` with the jQuery UI theme saved to `$.tablesorter.themes.jui`
  - The themes variable allows you to modify the class names for the table, header, sort icons, active state, hover state, filter inputs and zebra striping. See the code below on how to extend these variables.
  - Set the `uitheme` widget option to `"jui"` to set the widget to use the jQuery UI theme. See the bootstrap demo for another example.
- Earlier widget versions required jQuery 1.4+. The UITheme widget for tablesorter 2.4+ requires jQuery 1.2.6+.

# Demo

jQuery UI Theme:

Some interesting caption
First Name | Last Name | Age | Total | Discount | Date
--- | --- | --- | --- | --- | ---
First Name | Last Name | Age | Total | Discount | Date
Peter | Parker | 28 | $9.99 | 20% | Jul 6, 2006 8:14 AM
John | Hood | 33 | $19.99 | 25% | Dec 10, 2002 5:14 AM
Clark | Kent | 18 | $15.89 | 44% | Jan 12, 2003 11:14 AM
Bruce | Almighty | 45 | $153.19 | 44% | Jan 18, 2001 9:12 AM
Bruce | Evans | 22 | $13.19 | 11% | Jan 18, 2007 9:12 AM

# Page Header

    <!-- ui theme stylesheet - contents shown below -->
    <link rel="stylesheet" href="../css/theme.jui.css">
    <!-- jQuery UI theme (cupertino example here) -->
    <link rel="stylesheet" href="css/jquery-ui.min.css">

    <!-- tablesorter plugin -->
    <script src="../js/jquery.tablesorter.js"></script>
    <!-- tablesorter widget file - loaded after the plugin -->
    <script src="../js/jquery.tablesorter.widgets.js"></script>

# Javascript

# HTML

Next up: UITheme widget - Bootstrap theme ››
Second time around: Modifying the Header during rendering ››