Row Filtering

Show only table rows that contain defined keywords.

For sites that need to show many “small” tables with the same structure, e.g. entries from an inventory database, it can be beneficial to keep all rows in one “big” table, to simplify maintaining and editing the data.

Overview

While manually hiding rows, even with configuration parameters, allows showign only a subset of all table rows, this approach can be cumbersome, as the numbers of the table rows need to remain the same. If a row would move, e.g. because more are inserted in a table, this will cause a lot of extra work.

Therefore, an approach similar to a database select query can help, so that only rows with a certain keyword in a column are shown, instead of the full table. That’s the use case for which the Row Filtering feature module can be used.

Basic example

Imagine having a long table, e.g. a contacts list, with names, birthdays, companies, etc. of many people. The Row Filtering module allows to show only a subset of those people, here e.g. those from a specific company:

Last NameFirst NameBirthdayCompanyPhone (Ext.)ZIP codeCountryBalancePointsRating
ValenzuelaLunea01/09/1966Cisco970-865551606Germany$74.0773.7
MoranAugust07/04/1986Cisco651-121460737India$22.6417.5
BuckleyStone09/11/1980Cisco422-799874057United States$30.0127.9

Logic operators

The example above shows the filtering for a single filter term (a single company). Using logic operators, || (for “or”) and && (for “and”), it is possible to search for multiple filter terms. This example uses the || operator to show contacts from two different companies:

Last NameFirst NameBirthdayCompanyPhone (Ext.)ZIP codeCountryBalancePointsRating
CainLawrence05/16/1994IBM701-310898004United States$54.8152.5
ValenzuelaLunea01/09/1966Cisco970-865551606Germany$74.0773.7
LoganShay09/13/1968IBM687-648203023United States$46.3987.6
MoranAugust07/04/1986Cisco651-121460737India$22.6417.5
BuckleyStone09/11/1980Cisco422-799874057United States$30.0127.9

Similarly, this example shows a table that uses the && operator to show contacts from a certain country and company:

Last NameFirst NameBirthdayCompanyPhone (Ext.)ZIP codeCountryBalancePointsRating
ValenzuelaLunea01/09/1966Cisco970-865551606Germany$74.0773.7

Important note: For technical reasons, mixing the logic operators in the same table is not possible!

Additional settings

The filtering of rows can be further controlled using additional settings:

  • It is possible to specify which columns should be searched for the filter terms. By default, all columns are searched.
  • It is possible to select case-sensitive filtering. By default, case sensitivity does not matter, so that both upper- and lower-case matches would be found.
  • it is possible to turn on “Full cell matching”. The default behavior of the Row Filtering is to search for the filter terms anywhere in the cells. This could mean that e.g. the word car is found in a cell with the text shopping cart. Therefore, for some applications, it might make sense to only search the full cell content for matches.
  • In addition, it is possible to invert the “show matching rows” behavior into a “hide matching rows” behavior. This will result in the table only showing those rows that do not fulfill the filtering condition.

Usage instructions

To use this feature with your tables, choose the desired options in the “Row Filtering” section of the “Settings” sidebar of the table’s “TablePress table” block when editing the post or page with the table.

The available settings for the Row Filtering module in the "Settings" sidebar of the "TablePress table" block.
The available settings for the Row Filtering module in the “Settings” sidebar of the “TablePress table” block.

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
Row Filteringrow-filteringfilterstring"" (empty string)
Row Filteringrow-filteringfilter_full_cell_matchboolean (true or false)false
Row Filteringrow-filteringfilter_case_sensitiveboolean (true or false)false
Row Filteringrow-filteringfilter_columnsstring"" (empty string) // “” equates to ‘all’.
Row Filteringrow-filteringfilter_inverseboolean (true or false)false
Row Filteringrow-filteringfilter_url_parameterstring"" (empty string)