Watch
1
0
Fork
You've already forked dokuwiki-plugin-simpletablesort
0
Simple DokuWiki plugin that adds a live filter and click-to-sort columns to tables wrapped in .
  • JavaScript 56.9%
  • PHP 38.2%
  • Less 4.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
cblte f142e5c5d1 feat: add toolbar button to wrap tables in <simpletablesort>
- 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>
2026-11-10 18:25:11 +01:00
conf Initial release: live filter and click-to-sort for tables 2026-11-02 15:30:00 +01:00
images feat: add toolbar button to wrap tables in <simpletablesort> 2026-11-10 18:25:11 +01:00
lang feat: add toolbar button to wrap tables in <simpletablesort> 2026-11-10 18:25:11 +01:00
action.php feat: add toolbar button to wrap tables in <simpletablesort> 2026-11-10 18:25:11 +01:00
LICENSE Initial release: live filter and click-to-sort for tables 2026-11-02 15:30:00 +01:00
plugin.info.txt feat: add toolbar button to wrap tables in <simpletablesort> 2026-11-10 18:25:11 +01:00
README.md feat: add toolbar button to wrap tables in <simpletablesort> 2026-11-10 18:25:11 +01:00
script.js Initial release: live filter and click-to-sort for tables 2026-11-02 15:30:00 +01:00
style.less Initial release: live filter and click-to-sort for tables 2026-11-02 15:30:00 +01:00
syntax.php Initial release: live filter and click-to-sort for tables 2026-11-02 15:30:00 +01:00

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 minchars characters (default 2).
    • Case-insensitive; multiple words must all match (in any column).
    • Shows "x of y rows" while filtering; Esc clears the field.
  • ↕️ Click-to-sort: click a column heading to cycle ascending ▲, descending ▼, original order. Keyboard: focus the heading with Tab, press Enter or Space.
    • 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 2 before Item 10).
    • Empty cells always go last.
  • 🧩 Filter and sort work together.
  • 🎯 Opt-in per table via <simpletablesort>, or for every table via the alltables setting.
  • 🔘 Toolbar button that wraps the selected table in <simpletablesort>.
  • 🌍 English and German UI strings.

Installation

Extension Manager (recommended)

  1. Download the repository as a ZIP file (or build one, see below).
  2. In DokuWiki go to Admin → Extension Manager → Manual Install.
  3. 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 match base in plugin.info.txt), otherwise DokuWiki won't load the plugin. When building a ZIP yourself, put the files inside a simpletablesort/ 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 sim shows rows containing both "2016" and "sim".
  • Press Esc or 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,000 sorts as 1, not 1000.
  • Tables are found inside DokuWiki's div.table wrapper or as table.inline; tables built by other plugins with different markup may not be picked up.

How it works

  • syntax.php turns <simpletablesort> into a div.simpletablesort wrapper (with data-minchars if given). The table syntax inside is parsed by DokuWiki as usual.
  • action.php passes the settings to the browser via $JSINFO (per request, so config changes apply immediately) and adds the toolbar button (TOOLBAR_DEFINE).
  • script.js finds the tables, adds the filter field above DokuWiki's div.table scroll 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.less styles the filter bar and the sort arrows.
  • lang/ holds the English and German UI and settings strings.

License

MIT, see LICENSE.