DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:tablefilterjs

tablefilterjs Plugin

Compatible with DokuWiki

2018-04-22 "Greebo", !2014-09-29 “Hrun”, 2013-05-10 “Weatherwax”, 2012-10-13 “Adora Belle”, 2012-01-25 “Angua”

plugin Filter DokuWiki table using JavaScript regexps

Last updated on
2017-09-29
Provides
Syntax
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with filter, javascript, tables

Description

This plugin allows you to filter rows in your DokuWiki table by using javascript regex. The plugin is much more useful with Include Plugin which allows you to have one page where you store your data and several others where you store filtered informations.

Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Examples/Usage

Let's say that we have table that contains names and birth's date and we want to know who was born in 08-11-1994:

<filter Birthday=/08-11-1994/>
^Name^Birthday^
|User 1|12-12-1995|
|User 2|08-11-1994|
|User 3|18-12-1994|
</filter>

or more briefly (using cols index instead of names).

<filter 2=/08-11-1994/>
^Name^Birthday^
|User 1|12-12-1995|
|User 2|08-11-1994|
|User 3|18-12-1994|
</filter>

This will return only the second row.

Now let's try something more complexed. For example select all persons born in 1994:

<filter 2=/\d{1,2}-\d{1,2}-1994/>
^Name^Birthday^
|User 1|12-12-1995|
|User 2|08-11-1994|
|User 3|18-12-1994|
</filter>

Here we've used javascript regexp syntax. You can read more about it here.

Using tablefilterjs with Include Plugin

As I've mentioned before this plugin is mostly useful when used together with Include Plugin. You can read more about this plugin on it's page but there are several things to remember when you want to use it together with tablefilterjs.

To use DokuWiki table nested by include on one of your page. Use following syntax:

<filter "Data"=/201[0-9]{1}/>
{{page>test&inline}}
</filter>

Remember about adding inline flag. Without it tablefilterjs will simply not work.

There are also several other include flags that you may consider usefull:

<filter "Data"=/201[0-9]{1}/>
{{page>test&inline&nofooter&noeditbutton&noheader}}
</filter>

This flags cause that only the source table will be shown, without unnecessary (headers, footers, edit buttons).

Syntax

There are two variants of syntax. First allows you to use table headers as row names that will be used to filter table. Ex.:

<filter "Test row"=/test/>
</filter>

If your header contains “ you can use ' instead. Ex.

<filter 'Test "something" row'=/test/>
</filter>

Alternatively you can use \ char in order to quote ' or ":

<filter 'Test \'something\' row'=/test/>
</filter>

Instead of using headers you can use headers numbers(1 means first column):

<filter 1=/another test/ 2=/something more/>
</filter>

You can of course mix this two syntax variants:

<filter 1=/another test/ "Test row"=/test/>
</filter>

After = you need to put JavaScript compatible regexp between / / characters. After second / you can set regexp flags. For example:

<filter 1=/another test/i>
</filter>

Configuration and Settings

The plugin doesn't have any configuration options.

Development

Change Log

Releases:

Discussion

plugin/tablefilterjs.txt · Last modified: 2021-02-15 22:31 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki