- JavaScript 56.9%
- PHP 38.2%
- Less 4.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
- TOOLBAR_DEFINE button wraps the selection, or inserts a sample table - New table icon with sort arrow, EN/DE tooltip and sample strings - Add downloadurl and sourcerepo to plugin.info.txt, bump to 0.3.0 - Document the toolbar button in the README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
| conf | ||
| images | ||
| lang | ||
| action.php | ||
| LICENSE | ||
| plugin.info.txt | ||
| README.md | ||
| script.js | ||
| style.less | ||
| syntax.php | ||
Simple Table Sort Plugin for DokuWiki
Small, no-nonsense table improvements for DokuWiki: a live filter field and click-to-sort columns for the tables you choose. No extra syntax inside the table, no JavaScript libraries, no server round trips.
Features
- 🔎 Live filter: a text field above the table hides every row that
doesn't match what you type.
- Starts filtering after
mincharscharacters (default 2). - Case-insensitive; multiple words must all match (in any column).
- Shows "x of y rows" while filtering;
Escclears the field.
- Starts filtering after
- ↕️ Click-to-sort: click a column heading to cycle ascending ▲,
descending ▼, original order. Keyboard: focus the heading with
Tab, pressEnterorSpace.- Numbers (
1.234,5,12.5,3.000,30 %) and dates (31.12.2026,2026-12-31) sort by value when the whole column is numeric/date. - Everything else sorts as natural text (
Item 2beforeItem 10). - Empty cells always go last.
- Numbers (
- 🧩 Filter and sort work together.
- 🎯 Opt-in per table via
<simpletablesort>, or for every table via thealltablessetting. - 🔘 Toolbar button that wraps the selected table in
<simpletablesort>. - 🌍 English and German UI strings.
Installation
Extension Manager (recommended)
- Download the repository as a ZIP file (or build one, see below).
- In DokuWiki go to Admin → Extension Manager → Manual Install.
- Upload the ZIP file.
Manually
Copy this folder to lib/plugins/simpletablesort/ in your DokuWiki
installation.
The folder name must be exactly
simpletablesort(it has to matchbaseinplugin.info.txt), otherwise DokuWiki won't load the plugin. When building a ZIP yourself, put the files inside asimpletablesort/folder.
Quick guide
1. Wrap a table
Put <simpletablesort> on the line above your table and
</simpletablesort> on the line below:
<simpletablesort>
^ Game ^ Genre ^ Year ^ Rating ^
| Zelda: BotW | Adventure | 2017 | 9,5 |
| Tetris | Puzzle | 1984 | 8 |
| Stardew Valley | Simulation | 2016 | 9 |
| Hades | Roguelike | 2020 | 9,2 |
</simpletablesort>
Or select the table in the editor and click the toolbar button (table icon with an arrow). Without a selection it inserts a small sample table.
Save the page. The table now has a filter field above it, and every column heading shows a small ↕ arrow.
2. Filter
Type into the field, e.g. puz. After two characters only the matching rows
remain, and a counter shows how many are visible (1 of 4 rows).
- Several words narrow the result down:
2016 simshows rows containing both "2016" and "sim". - Press
Escor clear the field to show all rows again.
3. Sort
Click a column heading:
| Click | Result |
|---|---|
| 1st | ascending ▲ |
| 2nd | descending ▼ |
| 3rd | original order (↕) |
Clicking another column starts again at ascending.
4. Adjust per table (optional)
Start filtering only after three characters for this one table:
<simpletablesort minchars=3>
...
</simpletablesort>
5. Several tables
Every table inside a <simpletablesort> block gets its own filter field and
sortable headings:
<simpletablesort>
^ Name ^ City ^
| Anna | Berlin |
Some text in between.
^ Game ^ Genre ^
| Zelda | Adventure |
</simpletablesort>
Tables outside the block stay untouched.
Configuration
Admin → Configuration Settings → Simpletablesort, or in conf/local.php:
| Setting | Default | Meaning |
|---|---|---|
alltables |
0 |
0: only tables inside <simpletablesort>. 1: every wiki table gets filter and sort. |
minchars |
2 |
Filter starts after this many typed characters. Can be overridden per block. |
minrows |
3 |
Only with alltables on: tables with fewer data rows are left alone. |
Example conf/local.php:
$conf['plugin']['simpletablesort']['alltables'] = 1;
$conf['plugin']['simpletablesort']['minchars'] = 3;
A table you wrap in <simpletablesort> is always enhanced, no matter how
few rows it has.
Limitations
- Header rows in the middle of a table end up above the data once sorted.
- Cells spanning rows (
:::/rowspan) are not supported for sorting. - A comma is read as decimal separator:
1,000sorts as 1, not 1000. - Tables are found inside DokuWiki's
div.tablewrapper or astable.inline; tables built by other plugins with different markup may not be picked up.
How it works
syntax.phpturns<simpletablesort>into adiv.simpletablesortwrapper (withdata-mincharsif given). The table syntax inside is parsed by DokuWiki as usual.action.phppasses the settings to the browser via$JSINFO(per request, so config changes apply immediately) and adds the toolbar button (TOOLBAR_DEFINE).script.jsfinds the tables, adds the filter field above DokuWiki'sdiv.tablescroll wrapper and makes the last header row above the data clickable. Header rows (<thead>, or rows made only of<th>cells) are never filtered or moved.style.lessstyles the filter bar and the sort arrows.lang/holds the English and German UI and settings strings.
License
MIT, see LICENSE.