Tablesorter demo

All options included, as well as the uitheme widget

by Mottie

HTML

<script src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.js"></script>
<script src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.widgets.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://mottie.github.com/tablesorter/css/theme.bootstrap.css">
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>

                </button>
                 <h4 class="modal-title" id="myModalLabel">Modal title</h4>

            </div>
            <div class="modal-body">
                <table id="table0" class="tablesorter">
                    <caption>Student Grades</caption>
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Major</th>
                            <th>Sex</th>
                            <th>English</th>
                            <th>Japanese</th>
                            <th>Calculus</th>
                            <th class="filter-false sorter-false">Geometry</th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th>Name</th>
                            <th>Major</th>
                            <th>Sex</th>
                            <th>English</th>
                            <th>Japanese</th>
          ...

CSS

/* Bootstrap tweaks 
 adjust margin-top to accomodate for the Modal title block
 adjust margin-left to tweak positioning
*/
 .tablesorter-sticky-wrapper {
    margin-top: -87px;
    margin-left: -2px;
}
.modal-body {
    overflow-x: auto;
}

JavaScript

/* Documentation for this tablesorter FORK can be found at
 * http://mottie.github.io/tablesorter/docs/
 */
$(function () {

    $('#myModal').on('shown.bs.modal', function () {
        $('#table0').tablesorter({
            theme: 'bootstrap',
            headerTemplate: '{content} {icon}', // Add icon for various themes
            widgets: ['zebra', 'filter', 'uitheme', 'stickyHeaders'],
            widgetOptions: {
                // jQuery selector or object to attach sticky header to
                stickyHeaders_attachTo: '#myModal',
                stickyHeaders_offset : 0,
                stickyHeaders_addCaption: true
            }
        });
        // make sure the stickyHeader isn't showing the second
        // time a modal is opened
        $('#myModal').scroll();
    });

});