DataTables Plugin
This plugin add DataTables jQuery plug-in (https://datatables.net) support to DokuWiki.
For more information see Datatables Plugin page on DokuWiki.org!
Installation
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Syntax
Basic Syntax
<datatables> ^ Column A ^ Column B ^ Column C ^ | Row A1 | Row B1 | Row C1 | | Row A2 | Row B2 | Row C2 | | Row A2 | Row B2 | Row C3 | </datatables>
Column A | Column B | Column C |
---|---|---|
Row A1 | Row B1 | Row C1 |
Row A2 | Row B2 | Row C2 |
Row A2 | Row B2 | Row C3 |
Complex Headers
<datatables> ^ Name ^^ ^ First ^ Last ^ | My | Name | | Your | Name | </datatables>
Name | |
---|---|
First | Last |
My | Name |
Your | Name |
Other Examples
Options
Option | Description | Allowed values | Default value |
---|---|---|---|
scroll-y | Vertical scrolling | px , integer , boolean | false |
scroll-x | Horizontal scrolling | px , integer , boolean | false |
page-length | Number of elements to display per page | integer | 10 |
paging | Enable or disable table pagination | boolean | true |
ordering | Feature control ordering (sorting) abilities in DataTables | boolean | true |
info | Feature control table information display field | boolean | true |
order | Initial order (sort) to apply to the table | json | [[0, 'asc']] |
searching | Feature control search (filtering) abilities | boolean | true |
length-change | Feature control the end user's ability to change the paging display length of the table | boolean | true |
state-save | State saving - restore table state on page reload | boolean | false |
auto-width | Feature control DataTables' smart column width handling | boolean | true |
paging-type | Pagination button display options | simple – 'Previous' and 'Next' buttons only simple_numbers – 'Previous' and 'Next' buttons, plus page numbers full – 'First', 'Previous', 'Next' and 'Last' buttons full_numbers – 'First', 'Previous', 'Next' and 'Last' buttons, plus page numbers | simple_numbers |
dom | Define the table control elements to appear on the page and in what order | string | lfrtip |
Notes
- The option names are actually used as HTML5 data attributes, so they must be formatted with hyphens-and-lower-case instead of camelCase (see https://datatables.net/manual/options#HTML-5-data-attributes).
- Do not prepend option names with
data-
. The prefix will be added by the plugin. - Complex option values must be specified using valid JSON, wrapped with single quotes
'
. For example:order='[[0, "asc"]]'
orsearch='{"search":"fred"}'
.
Extra Options
The plugin also implements extra features beyond the options from DataTables jQuery library.
Option | Description | Allowed values | Default value |
---|---|---|---|
header-rows | Makes sure the table header contains at least the specified number of rows, so that it can be formatted by DataTables. It transfers the first rows of the table body into the table header if necessary. Particularly useful when formatting tables generated by other plugins, which may not have created a proper table header. | integer | 0 (no effect) |
Extensions
Attribute | Example | |
---|---|---|
Fixed Header | fixed-header | fixed-header=“true” or fixed-header='{ “header”: true, “headerOffset”: 50 }' |
Fixed Columns | fixed-columns | fixed-columns=“true” |
Responsive | responsive | responsive=“true” |
Buttons | buttons | buttons='[ “copy”, “csv”, “print” ]' |
Development
ChangeLog
- Added pdfmake and jszip by giterlizzi (2020/06/15 00:03)
- Updated release date by giterlizzi (2020/06/14 23:40)
- Updated DataTables to latest release and added support to Hogfather r… by giterlizzi (2020/06/14 23:38)
- Updated release date by giterlizzi (2016/03/14 17:46)
- Added "width=100%" for all DataTable tables (thanks to @polyzen on Lo… by giterlizzi (2016/03/14 17:41)
Known Bugs and Issues
Please report bugs or feature requests at the Bug tracker.