tristen/tablesort

↕️ A small tablesorter in plain JavaScript

JavaScript

1,146

263 commits

updated Apr 15, 2026

See the code

README

tablesort

A small & simple sorting component for tables written in JavaScript

Build Status npm version

Quick start

<script src='tablesort.min.js'></script>

<!-- Include sort types you need -->
<script src='tablesort.number.js'></script>
<script src='tablesort.date.js'></script>

<script>
  new Tablesort(document.getElementById('table-id'));
</script>

See usage and demos for more


Browser Support

Chrome logoFirefox logoInternet Explorer logoOpera logoSafari logo
8+ ✔3.6+ ✔10+ ✔11.50+ ✔5.1+ ✔

Node/Browserify

import tablesort from 'tablesort';

tablesort(el, options);

Default CSS

Add the styling from tablesort.css file to your CSS or roll with your own.

Extending Tablesort

If you require a sort operation that does not exist in the sorts directory, you can add your own.

Tablesort.extend('name', item => {

  // Regular expression to test against.
  // `item` is a table value to evaluate.
  return /foo/.test(item);
}, (a, b) => {

  // Custom sort functionality goes here.
  // e.g var n = (a > b) ? -1 : 1;
  return n;
});

If you've made an extend function that others would benefit from pull requests are gladly accepted!

Contributing

Dependencies: Node.js 22.

Tablesort relies on Grunt as its build tool. Simply run npm run build to package code from any contributions you make to src/tablesort.js before submitting pull requests.

Tests are run via:

npm test

Running the demo locally

jekyll serve

Then open http://localhost:4000/demo/ (or whatever port it uses).

Licence

MIT

Bugs?

Create an issue

javascript
tablesort

tristen/tablesort

↕️ A small tablesorter in plain JavaScript

JavaScript

1,146

263 commits

updated Apr 15, 2026

See the code

README

tablesort

A small & simple sorting component for tables written in JavaScript

Build Status npm version

Quick start

<script src='tablesort.min.js'></script>

<!-- Include sort types you need -->
<script src='tablesort.number.js'></script>
<script src='tablesort.date.js'></script>

<script>
  new Tablesort(document.getElementById('table-id'));
</script>

See usage and demos for more


Browser Support

Chrome logoFirefox logoInternet Explorer logoOpera logoSafari logo
8+ ✔3.6+ ✔10+ ✔11.50+ ✔5.1+ ✔

Node/Browserify

import tablesort from 'tablesort';

tablesort(el, options);

Default CSS

Add the styling from tablesort.css file to your CSS or roll with your own.

Extending Tablesort

If you require a sort operation that does not exist in the sorts directory, you can add your own.

Tablesort.extend('name', item => {

  // Regular expression to test against.
  // `item` is a table value to evaluate.
  return /foo/.test(item);
}, (a, b) => {

  // Custom sort functionality goes here.
  // e.g var n = (a > b) ? -1 : 1;
  return n;
});

If you've made an extend function that others would benefit from pull requests are gladly accepted!

Contributing

Dependencies: Node.js 22.

Tablesort relies on Grunt as its build tool. Simply run npm run build to package code from any contributions you make to src/tablesort.js before submitting pull requests.

Tests are run via:

npm test

Running the demo locally

jekyll serve

Then open http://localhost:4000/demo/ (or whatever port it uses).

Licence

MIT

Bugs?

Create an issue

javascript
tablesort

Project health

Overall

3.8/10

Maintained

0/10

Code review

5/10
OpenSSF Scorecard

Latest release

5.7.1 · Apr 15, 2026

Releases this year

2

Significant stargazers

ObserverOfTime

184 followers · starred Mar 2020

Luigi Pinca

624 followers · starred Mar 2012

Emery Berger

1,504 followers · starred Jan 2022

Scott O'Hara

1,078 followers · starred Feb 2017