
TABLE-SORT-JS.
Install instructions.
Option 1. Install from npm: npm install table-sort-js
import tableSort from "table-sort-js/table-sort.js";
Refer to the documentation for examples on using table-sort-js with frontend frameworks such as
ReactJS.
Option 2. Download table-sort.js (Select save as.)
Then add the following script before your HTML table:
<script src="table-sort.js"></script>
Refer to the documenation for examples how to use table-sort-js with HTML.
To make tables sortable:
- Add
class="table-sort"
to HTML <table> tags.
- Click on table headers to sort columns.
Classes:
"table-sort" | Make the table sortable! (Words, numbers, dates) |
"table-arrows" | Display ascending or descending triangles. |
"remember-sort" | If clicking on different columns remembers sort of the original column. |
"order-by-desc" | Order by descending on first click. (default is aescending) |
"file-size" | Sort file sizes(B->TiB) uses the binary prefix. (e.g KiB) |
"data-sort" | Sort by data attributes, e.g <td data-sort="42"> |
"disable-sort" | Disallow sorting the table by this specific column |
Development:
If you wish to contribute, install instructions can be found here.