Sort Tables Alphabetically - jQuery sortableTable.js

Sort Tables Alphabetically - jQuery sortableTable.js
File Size: 4.37 KB
Views Total: 145
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A basic, fast jQuery sortable table plugin that makes it possible to sort the columns in an HTML table alphabetically by clicking headers.

How to use it:

1. Include the stylesheet jquery.sortableTable.css for ASC & DESC icons and cursor changes

<link rel="stylesheet" href="jquery.sortableTable.css" />

2. Include the JavaScript jquery.sortableTable.js after jQuery.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/jquery.sortableTable.js"></script>

3. Add the CSS class to the HTML table and the plugin will do the rest.

<table class="ui-sortable-table">
  <thead>
    <tr>
      <th>First Name</th>
      <th>Last Name</th>
    </tr>
  </thead>
  <tbody>
    <tr><td>Peg</td><td>Legge</td></tr>
    <tr><td>Eileen</td><td>Sideways</td></tr>
    <tr><td>Augusta</td><td>Wind</td></tr>
    <tr><td>Chris</td><td>Anthemum</td></tr>
    <tr><td>Hope</td><td>Furaletter</td></tr>
    <tr><td>Bess</td><td>Twishes</td></tr>
    <tr><td>Dee</td><td>End</td></tr>
    <tr><td>Willie</td><td>Makit</td></tr>
    <tr><td>Anna</td><td>Littlical</td></tr>
    <tr><td>Saul</td><td>Goodmate</td></tr>
  </tbody>
</table>

This awesome jQuery plugin is developed by beaudurrant. For more Advanced Usages, please check the demo page or visit the official website.