History: Tablesorter
Preview of version: 41
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.
Please consider, that the implementation of tablesorter is still marked as experimental by Feb. 2015.
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
- 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 | PluginTrackerlist | 12 |
Plugin | PluginList | 15 |
Users | Admin users list (tiki-adminusers.php) | 12 |
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 |
Configuration
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. This table of parameters may be added to a documentation page by using PluginInclude and referring to the startinclude and stopinclude text for the starting and stopping points of the include.
startinclude
In order to use tablesorter,
- Javascript must be enabled
- Enabled by default at Admin > Features > Programmer (tab)
- jQuery Sortable Tables must be activated
- Enable at Admin > Features > Interface (tab)
- 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)
Introduced in Tiki 1.
Go to the source code
Preferences required: feature_trackers, wikiplugin_trackerlist
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 |
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 |
Parameter | Purpose | Usage | Optional | Since |
---|---|---|---|---|
sortable | Turn sorting / filtering / paginating on and set sort button and save settings. This setting is needed for all other features to work. | 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:buttontext to allow sorting and show an unsort button with custom text. Enter type:savereset;text:buttontext to allow the same for saved sorts. |
optional, but needs to be set to something other than n for the features to be turned on | 4.0, enhanced in 12.0 |
server | Choose to use browser or server to filter, sort and paginate | 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) if you do not want all rows fetched at once, but rather fetch rows as you paginate, filter or sort. together with trackers (trackerlist) tablesorter might not fetch all items -> in this case use server="y" and it should work. |
optional | 12.0 |
sortList | To pre-sort columns or disallow sorting by colum | Enter 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. | optional | 4.0, enhanced in 12.0 |
tsortcolumns | Set data type of column for more accurate sorting and set group headers | Set type and group settings for each column, using | to separate columns. To show group headings upon page load, the sortList parameter will need to be set for a column with a group setting. Group will not work in plugins where the server parameter is set to y. type tells the sorter what type of date is being sorted and choices include: text, digit, currency, percent, usLongDate, shortDate, isoDate, dateFormat-ddmmyyyy, ipAddress, url, time. Also handle strings in numeric columns with string-min and string-max. Handle empty cells with empty-top, empty-bottom or 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 first 2 words. number-10 will group rows in blocks of ten. |
optional | 12.0 |
tsfilters | Set filter settings | 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.) Dropdown - type:dropdown;placeholder:****;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. Date range - type:date;format:yyyy-mm-dd;from:2013-06-30;to:2013-12-31%%%(from and to values set defaults for these fields when user clicks on the input field) 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. |
optional | 12.0 |
tsfilteroptions | To set additional filter-related options | The following options are available: type:reset (adds button to take off filters), and style: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" | optional | 12.0 |
tspaginate | To add pagination controls and text | 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 custom values as in the following example: max:40;expand:60;expand:100;expand:140 | optional, except needs to be set when the server parameter is set to y | 12.0 |
tscolselect | To hide and prioritize columns | 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" | optional | 14.0 |
stopinclude