🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

table-sort-js

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table-sort-js

A JavaScript client-side HTML table sorting library with no dependencies required.

1.13.0
Source
npm
Version published
Weekly downloads
2K
0.59%
Maintainers
1
Weekly downloads
 
Created
Source

table-sort-js table-sort-js table-sort-js table-sort-js table-sort-js

TABLE-SORT-JS.

  • Description: A JavaScript client-side HTML table sorting library with no dependencies required.

  • Demo

  • Documentation. (work in progress)

  • npm package.

  • firefox browser extension

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 React.js and Vue.js

Option 2. Download table-sort.js (Select save as.), or download a minified version (~5kB)

Then add the following script before your HTML table:

<script src="table-sort.js"></script>

Refer to the documenation for examples on 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> classesDescription
"table-sort"Make the table sortable! (Words, numbers, dates, file sizes)...
"table-arrows"Display ascending or descending triangles.
"no-class-infer"Turns off inference for adding sort classes automatically i.e (file-size-sort, runtime-sort, dates-dmy-sort).
"remember-sort"If clicking on different columns remembers sort of the original column.
<th> classesDescription
"data-sort"Sort by data attributes, e.g <td data-sort="42">
"onload-sort"Sort column on loading of the page. Simulates a click from the user. (can only sort onload for one column)
"disable-sort"Disallow sorting the table by this specific column.
"dates-mdy-sort"Sorts dates in mm/dd/yyyy format. e.g (12/28/2023). Can use "/" or "-" or "." as separator. Overides inferred "dates-dmy-sort" class.
<th> Inferred Classes.Description
"dates-dmy-sort"Sorts dates in dd/mm/yyyy format. e.g (18/10/1995). Can use "/" or "-" or "." as separator.
"runtime-sort"Sorts runtime in hours minutes and seconds e.g (10h 1m 20s). Useful for sorting the GitHub actions Run time column...
"file-size-sort"Sorts file sizes(B->TiB) uses the binary prefix. (e.g KiB). Input data ideally in Bytes e.g (10b or 10B)
<th> Classes that change defaults.Description
"order-by-desc"Order by descending on first click. (default is aescending)
"alpha-sort"Sort alphabetically (z11,z2); default is natural sort (z2,z11).
"punct-sort"Sort punctuation; default ignores punctuation.

Development:

If you wish to contribute, install instructions can be found here.

Keywords

table

FAQs

Package last updated on 11 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts