3-state jQuery Table Sorting Plugin - tablesort3s

File Size: 19.4 KB
Views Total: 2112
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
3-state jQuery Table Sorting Plugin - tablesort3s

tablesort3s is a really small (~3kb) jQuery plugin that adds3-state sorting functionality (ascending, descending and unsorted) to existing html tables. Helps you sort a multi-column html table without page refreshes.

How to use it:

1. Load the jQuery tablesort3s plugin's style sheet in the document's head section.

<link rel="stylesheet" href="css/tablesort3s.css">

2. Load the jQuery tablesort3s plugin's JavaScript file after jQuery library but before the </body> tag.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="js/jquery.tablesort3s.js"></script>

3. Bind 3-state sort controls to tables with static content and/or sort/unsort them.

$('table').tablesort3s();

4. Available options with default values.

// array of 4 strings
// The 2 first strings are also used for the text content of the controls (for accessibility).
hints : null

// 0-based index of the header row to bind sort widget on
headerRow : 0.

// Applied on <tr> elements to check fakes.
fakeFilter : null,

// Applied on <th> elements to prevent widget binding individually.
noSortFilter : 'nosort',

// Class of the sort widget container.
widgetClass : 'sort'

// True to bind the sort widget even if the table has less than 2 rows.
forceUI : false.

Changelog:

v1.1.0 (02/15/2024)

  • added aria-sort attributes on header cells

v1.0.1 (11/20/2023)


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