DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:searchtablejs

This is an old revision of the document!


searchtablejs plugin

Compatible with DokuWiki

2009-12-25c, 2011-05-25a, angua, adora belle, weatherwax, binky, Ponder Stibbons, 2014-09-29 "Hrun"

plugin Filter tables in DokuWiki based on JavaScript

Last updated on
2010-10-25
Provides
Syntax
Repository
Source
Conflicts with
edittable

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

Similar to datatables, sortablejs, tablelayout

Tagged with filter, javascript, search, tables

Download and Installation

Download and install the plugin using the Plugin Manager using the URL given above. Refer to Plugins on how to install plugins manually.

Syntax and Usage

This script can be used the same way as the Sortablejs Plugin. It adds a small text field on top of your table and filters for the entered text. Esp. in combination with the CSV Plugin this small plugin is very useful.

Example:

<searchtable>
^ Test ^ Col1 ^ Col2 ^
| Row1 | Val1 | Val2 |
| Row2 | Val3 | Val4 |
</searchtable>

Example with sortable (you can combine it):

<searchtable>
<sortable>
^ Test ^ Col1 ^ Col2 ^
| Row1 | Val1 | Val2 |
| Row2 | Val3 | Val4 |
</sortable>
</searchtable>

Known Issues

  • Currently only one table per searchtable tag is supported. But you can use multiple tags per page.
  • No further options are supported at the moment, but planned. Stay tuned.

TODO

Changes

Improvement

A little improvement to give the Input a class-name

In syntax.php:

$renderer->doc .= '<div class="searchtable' . $match . '" id="' . $id . '">';
$renderer->doc .= '<form class="searchtable" onsubmit="return false;"><input class="searchtable" name="filtertable" onkeyup="searchtable.filterall(this, \'' . $id . '\')" type="text"></form>';


A new File: print.css

div.dokuwiki form.searchtable { display: none; }


A new File: style.css

what you like, similar to the text search input
  • It would be cool if you can select the column with should be filtered
  • Not working with latest DokuWiki and Template Arctic

Problem with IE8

IE8 has a different opinion than other browsers as to how a javascript array should be ended, so it barfs on this script.js code snippet:

...
  getTableByID: function(_id) {
        var _table = document.getElementById(_id).getElementsByTagName('table')[0];
        return _table;
  },
...

Remove the trailing comma after the last array entry, and presto!

...
  getTableByID: function(_id) {
        var _table = document.getElementById(_id).getElementsByTagName('table')[0];
        return _table;
  }
...

Strand Åge 2011/01/26 13:35

Conflict with EditTable plugin

How to resolve the conflict with EditTable plugin?

loyer 2014/06/14 17:24

Download the newest version, there is a fix now.

LMS23 2015-03-18 11:25

plugin/searchtablejs.1426674348.txt.gz · Last modified: 2015-03-18 11:25 by LMS23

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