Automatic Filter

Pre-filter a table when it is shown.

Sometimes it can be useful to initialize the “Search” field above a table with a filter word, for example to highlight a certain row in a table. The advantage of this method over the Row Filtering module is that the visitor can change the filter word, to e.g. see all entries in the table.

Feature description

Here is an example with a pre-filled Search field, a company name:

Last NameFirst NameBirthdayCompany
BanksTravis05/04/1969Apple

If you reload this page via these links, you will see how a different company is used for the pre-filtering, thanks to the company URL parameter that was configured for this:

This, for example, allows sending prepared URLs to site users, so that they will directly see desired search results.

Usage instructions

To use this feature with your tables, enable the “Automatic Filter” module on the TablePress “Modules” screen.

Then, activate and configure the feature for the desired tables in the “Settings’ sidebar of the “TablePress table” block.

Alternatively, use the Shortcode

[table id=123 datatables_auto_filter=test /]Code language: plaintext (plaintext)

to have the table filtered for test when the page is loaded. Change the 123 to your table’s ID.

Or, you could use

[table id=123 datatables_auto_filter_url_parameter=table_filter /]Code language: plaintext (plaintext)

to enable URLs like

https://example.com/page-with-table/?table_filter=wordCode language: plaintext (plaintext)

so that the filter term will be extracted from the URL parameter table_filter.

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
Automatic Filterdatatables-auto-filterdatatables_auto_filterstring"" (empty string)
Automatic Filterdatatables-auto-filterdatatables_auto_filter_url_parameterstring"" (empty string)