DataTables ColumnFilterWidgets

This is a Premium Extension for TablePress.
Support and development takes a lot of work. To allow me to offer Extensions in the future, please consider a donation. The recommended amount is $11. Thank you.

The DataTables JavaScript library has a ColumnFilterWidgets plugin that allows to add filtering dropdown boxes above the table. Each column will get a select box with all possible values from that column.

To use this, download, install, and activate the Extension like a regular WordPress plugin. Then, on the page where you want to show the table, insert the extended Shortcode

[table id=123 datatables_columnfilterwidgets=true /]

and change the 123 to the desired table ID. This will add dropdown boxes for every columns.

If you don’t want a dropdown box for every column, you can add another parameter to the Shortcode, with a comma separated list of columns, like

[table id=123 datatables_columnfilterwidgets=true datatables_columnfilterwidgets_exclude_columns=2,3,4 /]

This would add a dropdown box for all columns, except columns 2, 3, and 4.

Note that the column numbers here are meant without those columns that are hidden on the “Edit” screen of the table, i.e. only columns that are visible in the table should be counted when determining these column numbers.

To set a limit on the number of allowed selections per dropdown box, add this parameter:

[table id=123 datatables_columnfilterwidgets=true datatables_columnfilterwidgets_max_selections=1 /]

With that, only one value can be selected from each dropdown box at a time. The visitor would have to be remove it by clicking on it, before he can select another filter value.

If your filter columns contain a list of possible keywords, e.g. a list of colors (“red, blue, green, yellow”) where filtering should only be done for one color, you can define the separator characters for these keywords, so that the list is split automatically:

[table id=123 datatables_columnfilterwidgets=true datatables_columnfilterwidgets_separator=", " /]
Top