DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:tablefilterjs

tablefilterjs Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" unknown
  • 2015-08-10 "Detritus" unknown
  • 2014-09-29 "Hrun" no

plugin Filter DokuWiki table using JavaScript regexps.

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

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

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.

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

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: 2017-09-29 13:19 by solewniczak