User blog:Sammylau/Wikitable Filterable: The Filter for Long Tables

For those you may know, MediaWiki package has already provided a "sortable" table function which the page viewer may sort column values by ascending or descending order. But somehow, you should expect a filter function to get some specific stuff from a long table. Here we are.

Demo
A sample working example table is here: http://pad.wikia.com/wiki/User:Sammylau/FilterTable

Setup
$(function{	importArticles({ type: "script", articles: ["u:pad.wikia.com:MediaWiki:FilterTable.js"] }); });
 * You have to be an admin of the wiki
 * Insert the code into the MediaWiki:Common.js page of your own wiki: (or extend it with proper syntax if you already using some plugins)

Usage
Just like the way you use the "sortable" class with tables. Turn into source code mode and modify your table header like this: The filterable table will take the first row as your header column and finds distinct values in the column to make a list of filter options.

If some column is not suitable to put a filter there, do this: So you have some unique IDs and filtering it isn't useful at all. You can turn off filter on that column by adding the unfilterable class.