Expand all

jquery.tablesorter

Provides a jQuery plugin that creates a sortable table.

Depends on mw.config (wgDigitTransformTable, wgDefaultDateFormat, wgPageContentLanguage) and mw.language.months.

Uses 'tableSorterCollation' in mw.config (if available).

Author:
  • Written 2011 Leo Koppelkamm. Based on tablesorter.com plugin, written (c) 2007 Christian Bach/christian.bach@polyester.se
License:
  • Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.gnu.org/licenses/gpl.html) licenses
Source:

Methods

$.fn.tablesorter(settings) → {jQuery}static #

Create a sortable table with multi-column sorting capabilities.

To use this jQuery plugin, load the jquery.tablesorter module with mw.loader.

Example

mw.loader.using( 'jquery.tablesorter' ).then( () => {
     // Create a simple tablesorter interface
     $( 'table' ).tablesorter();

     // Create a tablesorter interface, initially sorting on the first and second column
     $( 'table' ).tablesorter( { sortList: [ { 0: 'desc' }, { 1: 'asc' } ] } )
         .on( 'sortEnd.tablesorter', () => console.log( 'Triggered as soon as any sorting has been applied.' ) );
} );

Parameters:

Name Type Description
settings module:jquery.tablesorter~TableSorterOptions
Source:

Returns:

Type
jQuery
Create a sortable table with multi-column sorting capabilities.

Type Definitions

TableSorterOptions #

Type:

Properties:

Name Type Attributes Default Description
cssHeader string optional
"headerSort"

A string of the class name to be appended to sortable tr elements in the thead of the table.

cssAsc string optional
"headerSortUp"

A string of the class name to be appended to sortable tr elements in the thead on a ascending sort.

cssDesc string optional
"headerSortDown"

A string of the class name to be appended to sortable tr elements in the thead on a descending sort.

sortMultisortKey string optional
"shiftKey"

A string of the multi-column sort key.

cancelSelection boolean optional
true

Boolean flag indicating iftablesorter should cancel selection of the table headers text.

sortList Array optional

An array containing objects specifying sorting. By passing more than one object, multi-sorting will be applied. Object structure: { : <String 'asc' or 'desc'> }

Source: