Tablesorter

Tiki uses the Rob Garrison fork of the tablesorter jQuery plugin to add the ability for users to filter, sort, paginate and otherwise manipulate tables used in Tiki. The feature is considered experimental - please report any bugs or wishes.

Features

Tablesorter allows the following to be done without refreshing the page through use of jQuery and Ajax:

  • Sorting by clicking on active column headers.
    • sorts all items even if only a portion are retrieved from the server and displayed
  • Filtering by typing in text or using a dropdown
    • all items are filtered even if only some are shown
  • Pagination with pager controls
    • number of rows shown can be expanded as well
  • Sticky headers
    • the header row stays visible as you scroll down even when the top of the table is not visible
  • Resizable columns
    • place your cursor on the right edge of a header cell until the cursor turns into a resize icon - then click and move to the right or left
  • Column selector to hide columns
    • the button on the top left of the table allows you to hide a column for the duration of the session
  • Totals
    • automatically add column and table total rows and columns
  • Auto hide columns for small viewing windows

Tables where Tablesorter is available in Tiki

Below are the tables for which Tablesorter may be applied. For plugins, Tablesorter is optional even if the Tablesorter feature is activated. For other standard tables in Tiki, Tablesorter is automatically applied if the Tablesorter feature is turned on.

Feature Table Tiki version
Plugin PluginFancytable 12
Plugin PluginCustomSearch 16.3
Plugin PluginTrackerlist 12
Plugin PluginList 15
Users Admin users list (tiki-adminusers.php) 12
Groups Admin lists of groups, group members and users banned from a group (tiki-admingroups.php) 17
Wiki List of wiki pages (tiki-listpages.php) 14
Forum List of forums (tiki-forums.php) 14
Forum Topic list for a forum (tiki-view_forum.php) 14
Forum Admin forums (tiki-admin_forums.php) 14
Payment Payment tables (tiki-payment.php) 16

Prerequisites

In order to use tablesorter,

  1. Javascript must be enabled
    • Enabled by default at Admin > Features > Programmer (tab)
  2. jQuery Sortable Tables must be activated
    • Enable at Admin > Features > Interface (tab)
  3. For the server parameter to work for a plugin, and to apply tablesorter to any tiki table that is not a plugin, ajax must be enabled.
    • Enable at Admin > Features > Interface (tab)

Parameters

Below are the parameters that are used for plugins where this feature is available. See the related plugin documentation pages for more information and examples. List, filter and sort the items in a tracker

Go to the source code

Parameters Accepted Values Description Default Since
sortable any string except for HTML and PHP tags Serves as the overall switch for turning jQuery Tablesorter on (also for filtering) as well as overall sort settings. Enter y to allow sorting and n to disallow (n is the default). Enter type:save to allow sorts to be saved between page refreshes. Enter type:reset;text:***** to allow sorting and show an unsort button with custom text. Enter type:savereset;text:buttontext to allow the same for saved sorts. n 12.0
server any string except for HTML and PHP tags Enter y to have the server do the sorting and filtering through Ajax and n to have the browser do it (n is the default). Set to y (and also set the Paginate parameter (tspaginate)) if you do not want all rows fetched at once, but rather fetch rows as you paginate, filter or sort. n 12.0
tsfilters any string except for HTML and PHP tags Enter y for a blank text filter on all columns, or n for no filters. Or set custom column filters separated by | for each column for the following filter choices and parameters:
Text - type:text;placeholder:xxxx
(For PluginTrackerlist this will be an exact search, for other plugins partial values will work.)
From Tiki 18, you can add initial:t option to allow prefix search for text filter. E.g. type:text;initial:t
Dropdown - type:dropdown;placeholder:****;empty:****;option:****;option:****;option:****
Options generated automatically if not set and the server parameter is not y.
Use value=Display label to have the option value be different than the displayed label in the dropdown.
Use empty:Display label to include an option with the specified label that will filter only empty rows. Only used if other options are not specified manually.
Date range - type:date;format:yy-mm-dd;from:2013-06-30;to:2020-12-31
(from and to values set defaults for these fields when user clicks on the input field)Beware that items with empty date values will not be shown when default date range filters are applied.
Numeric range - type:range;from:0;to:50
No filter - type:nofilter
For example: tsfilters="type:dropdown;placeholder:Type to filter..." would result in a dropdown filter on the first column with all unique values in that column in the dropdown list.
12.0
tscolselect any string except for HTML and PHP tags Add a button for hiding and re-showing columns. Also sets priority for dropping columns when browser is too narrow. Set each column to a number between 1 and 6 (1 is highest priority and last to be dropped) or to critical to never hide or drop. An example with 4 columns:tscolselect="critical|4|5|6" 14.0
tsfilteroptions any string except for HTML and PHP tags The following options are available: reset (adds button to take off filters), and hide (Filters are revealed upon mouseover. Hide doesn't work when date and range filters are used.). To use both, set tsfilteroptions="type:reset;text:button text;style:hide" 12.0
tsoutput any string except for HTML and PHP tags Enter y to set default values based on the site setting. Set custom values as in the following example: delivery:d;saveFileName:exported_teblesorter.csv 24.5
tspaginate any string except for HTML and PHP tags Enter y to set default values based on the site setting for maximum records in listings (on the pagination table of the Look & Feel admin panel). Set to n (and server cannot be set to y) for no pagination. Set custom values as in the following example: max:40;expand:60;expand:100;expand:140 12.0
sortList any string except for HTML and PHP tags Bracketed numbers for column number (first column = 0) and sort direction (0 = ascending, 1 = descending, n = no sort, y = allow sorting but no pre-sort), for example: [0,y],[1,0],[2,n]. If the first pre-sorted or no filter column is not the first column, then you should use the y parameter (as in [0,y]) to assign all previous columns. 12.0
tsortcolumns any string except for HTML and PHP tags Set type and group settings for each column, using | to separate columns. To show group headings upon page load, the Pre-sorted Columns parameter (0sortList) will need to be set for a column with a group setting. Group will not work in plugins where the Server Side Processing parameter (server) is set to y.
Set type to one of the following: text, digit, currency, percent, usLongDate, shortDate, isoDate, dateFormat-ddmmyyyy, ipAddress, url, time, nosort
Also handle strings in numeric columns with: string-min, string-maxHandle empty cells with: empty-top, empty-bottom, empty-zero.
group creates automatic row headings upon sort with the heading text determined by the setting as follows: letter (first letter), word (first word), number, date, date-year, date-month, date-day, date-week, date-time.letter and word can be extended, e.g., word-2 shows the first 2 words. number-10 will group rows in blocks of ten. Group will not work in plugins where the Server Side Processing parameter (server) is set to y.
12.0
tstotaloptions any string except for HTML and PHP tags Pipe-separated options for totals for each column which are set in the tstotals parameter:
format - overrides the default number format set in tstotalformat
ignore - column will be excluded from total calculations set in the tstotals parameter. Remember to include any columns that will be added for row totals set in the tstotals parameter.
Example:ignore|ignore|#,###.
15.0
tstotals any string except for HTML and PHP tags Generate table, column or row totals and set labels, using either y or the following syntax for each total: type:value;formula:value;filter:value;label:value.
Setting to (y) will add one column total row set as follows: type:col;formula:sum;filter:visible;label:Totals.
Separate multiple total row or column settings with a pipe (|). Set type only to generate sums of visible values. In all cases, cells in columns set to be ignored in the tstotaloptions parameter will not be included in calculations.
Instructions for each total option follows:
type - Choices are col, for a row of columns totals, row, for a column of row totals, and all to include amounts from all cells in the table body in a row total.
formula - set what the calculation is. Choices are: sum, count, max, min, mean, median, mode, range, varp, vars, stdevp, stdevs. Click here for a description of these options.
filter - Determines the rows that will be included in the calculations (so no impact if type:row). Also, when server="y", only visible cells are included regardless of this setting. Choices are visible (rows visible on the page), unfiltered (all rows not filtered out, even if not visible because of pagination), all (all rows, even if filtered or hidden), and hidden (rows filtered out and rows hidden due to pagination).
label - set the label for the total, which will appear in the header for row totals and in the first column for column totals.
15.0


tsortcolumns also accepts type nosort

Samples

Tablesorter is an addition to another feature to see samples please follow those links;
Plugin FancyTable Sorting Filtering and Paginating
Plugin FancyTable Automatic Totals
Plugin List Table formatting with tablesorter