Show only table rows that contain defined keywords.
This feature module is part of the TablePress Premium plans.
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 Name | First Name | Birthday | Company | Phone (Ext.) | ZIP code | Country | Balance | Points | Rating |
---|---|---|---|---|---|---|---|---|---|
Valenzuela | Lunea | 01/09/1966 | Cisco | 970-8655 | 51606 | Germany | $74.07 | 7 | 3.7 |
Moran | August | 07/04/1986 | Cisco | 651-1214 | 60737 | India | $22.64 | 1 | 7.5 |
Buckley | Stone | 09/11/1980 | Cisco | 422-7998 | 74057 | United States | $30.01 | 2 | 7.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 Name | First Name | Birthday | Company | Phone (Ext.) | ZIP code | Country | Balance | Points | Rating |
---|---|---|---|---|---|---|---|---|---|
Cain | Lawrence | 05/16/1994 | IBM | 701-3108 | 98004 | United States | $54.81 | 5 | 2.5 |
Valenzuela | Lunea | 01/09/1966 | Cisco | 970-8655 | 51606 | Germany | $74.07 | 7 | 3.7 |
Logan | Shay | 09/13/1968 | IBM | 687-6482 | 03023 | United States | $46.39 | 8 | 7.6 |
Moran | August | 07/04/1986 | Cisco | 651-1214 | 60737 | India | $22.64 | 1 | 7.5 |
Buckley | Stone | 09/11/1980 | Cisco | 422-7998 | 74057 | United States | $30.01 | 2 | 7.9 |
Similarly, this example shows a table that uses the &&
operator to show contacts from a certain country and company:
Last Name | First Name | Birthday | Company | Phone (Ext.) | ZIP code | Country | Balance | Points | Rating |
---|---|---|---|---|---|---|---|---|---|
Valenzuela | Lunea | 01/09/1966 | Cisco | 970-8655 | 51606 | Germany | $74.07 | 7 | 3.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 textshopping 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.
On this page