Column Filter Dropdowns

Add a search dropdown for each column above the table.

This feature module allows adding filtering dropdown boxes above the table. Each column will get a select box with all possible values from that column.

Feature description

This table shows the dropdowns in use:

Last NameFirst NameBirthdayCompanyPhone (Ext.)ZIP codeCountryBalancePointsRating
BanksTravis05/04/1969Apple200-432464655Italy$61.1786.6
CainLawrence05/16/1994IBM701-310898004United States$54.8152.5
MiddletonDennis01/10/1992Google580-950180913Spain$24.8345.2
ValenzuelaLunea01/09/1966Cisco970-865551606Germany$74.0773.7
BurgessQuynn09/24/1988Mozilla430-894378965France$16.1382.9
LottLillith12/10/1978Dell587-228988178Australia$30.1217.9
FreemanCheyenne01/28/1981LG396-547314711Germany$49.8216.0
HoustonJorden05/03/1978Adobe970-118296036Canada$47.3121.5
HarrisMerritt12/29/1989Apple160-597725178United States$77.3360.1
GregoryBrynn01/13/1994Adobe663-603991558Spain$90.2498.2
CurryMason03/15/1969Sony115-477887513Australia$21.6856.6
HollandAlyssa06/25/1976Xerox704-497797921Canada$50.3179.5
LoganShay09/13/1968IBM687-648203023United States$46.3987.6
MoranAugust07/04/1986Cisco651-121460737India$22.6417.5
VasquezKelsey03/31/1968Samsung470-735879655Germany$84.0534.5
SteinLawrence10/15/1960Toshiba929-540736044Italy$77.1128.6
BattleWylie01/03/1988Facebook368-227637585Australia$46.37102.8
BookerLogan12/16/1975Apple830-570122074United States$40.7119.0
GilbertChaney06/06/1970Sony132-556089630Canada$78.4591.2
BuckleyStone09/11/1980Cisco422-799874057United States$30.0127.9

New feature! It is also possible to configure which columns should get a filter dropdown and in which order these should be shown!

Usage instructions

To use these features with your tables, activate the “Column Filter Dropdowns” feature module on the “Modules” screen of TablePress Pro or TablePress Max. Then, configure the desired options in the “Column Filter Dropdowns” section on the table’s “Edit” screen.

Configuration parameters

To configure this module’s features, you can also use these configuration parameters in the “TablePress Table” block or in the Shortcode that you are using to embed the table:

ModuleSlugConfiguration parameterNameDescriptionTypeDefault value
Column Filter Dropdownsdatatables-columnfilterwidgetsdatatables_columnfilterwidgetsboolean (true or false)false
Column Filter Dropdownsdatatables-columnfilterwidgetsdatatables_columnfilterwidgets_columnsstring"" (empty string)
Column Filter Dropdownsdatatables-columnfilterwidgetsdatatables_columnfilterwidgets_exclude_columnsstring"" (empty string)
Column Filter Dropdownsdatatables-columnfilterwidgetsdatatables_columnfilterwidgets_separatorstring"" (empty string)
Column Filter Dropdownsdatatables-columnfilterwidgetsdatatables_columnfilterwidgets_max_selectionsstring"" (empty string)
Column Filter Dropdownsdatatables-columnfilterwidgetsdatatables_columnfilterwidgets_group_termsboolean (true or false)false

Advanced configuration

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 /]Code language: JSON / JSON with Comments (json)

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 /]Code language: JSON / JSON with Comments (json)

With that, only one value can be selected from each dropdown box at a time. The visitor would have to 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=", " /]Code language: JSON / JSON with Comments (json)