Package Exports
- table-sort-js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (table-sort-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
TABLE-SORT-JS.
Description: A JavaScript client-side HTML table sorting library with no dependencies required.
Documentation. (work in progress)
Install instructions - pick one option.
- 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.
- 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 a table sortable:
- Add
class="table-sort"to HTML <table> tags. Click on the columns heads to sort.
Classes:
| table classes | Description |
|---|---|
| "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. |
| th classes | Description |
|---|---|
| "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) |
Notes:
- Makes use of natural sorting to sort numerical values correctly.
- If
<thead>does not exist it will be created by using data from first row.<tbody>is optional.
Development:
If you wish to contribute, install instructions can be found here.