Download the minified script
Quick start
<script src='tablesort.min.js'></script> <!-- Include sort types you need --> <script src='tablesort.numeric.js'></script> <script src='tablesort.date.js'></script> <script> new Tablesort(document.getElementById('table-id')); </script>
Sort Types
See all available sort types in the sort directory of the project. Defaults to string if no sort types are provided.
Additional options
CSS styling
Add the styling below to your CSS or roll with your own.
th.sort-header::-moz-selection { background:transparent; } th.sort-header::selection { background:transparent; } th.sort-header { cursor:pointer; } table th.sort-header:after { content:''; float:right; margin-top:7px; border-width:0 4px 4px; border-style:solid; border-color:#404040 transparent; visibility:hidden; } table th.sort-header:hover:after { visibility:visible; } table th.sort-up:after, table th.sort-down:after, table th.sort-down:hover:after { visibility:visible; opacity:0.4; } table th.sort-up:after { border-bottom:none; border-width:4px 4px 0; }
Licence
MIT