Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics

Enable Filtering for New Column Type

I successfully created a new column type following your guide here. Your guide shows how to make the new column type Sortable and Editable – but not how to enable Filtering.

Please advice: how can I enable Filtering for a new column type?

5 years, 7 months ago
Stefan van den Dungen Gronovius

Filtering is not that easy to implement as editing and sorting and it almost always requires custom logic.
That’s the reason that there is not a default implementation for this in the toolkit.
Currently, there are two ways to filter column in our plugin.

1) Filtering with the drop down options on the table screen
2) The new Smart Filtering feature (

Both solutions require a method in the column class that tells which model must be loaded.
Let’s take a numeric custom field and implement that already present model for that field.

For filtering it looks like

public function filtering() {
	return new ACP\Filtering\Model\CustomField\Numeric( $this );

for smart filtering it’s easier and it looks like:

public function search() {
	return new ACP\Search\Comparison\Meta\Numeric( $this->get_meta_key(), $this->get_meta_type() );

For the actual logic of the models and comparison you’ll need to have a look at the many examples in our code.

5 years, 7 months ago

You must be logged in to reply to this topic.