how to filter on default columns?
Created 7 years ago by emergingdzns

So in my module, I want to add filters using the $filters variable in the Table Builder functionality. I can add filters for all stream added fields. However I can't seem to add them for the ID, created_at, created_by columns etc. The default fields always result in an error.

In an ideal world, I'd like the "id" filter to allow integers only. The "created_at" filter would be a date selector (even better a between x/y dates selector). The created_by would be a drop-down of users by name or at the very least, a text entry that would filter user profiles based on the entered text.

Any ideas? Possibilities?

ryanthompson  —  7 years ago

You can use base filters instead of field filters.

For searching:

Note this is very close to field searching but it uses columns instead of fields.

For basic filters:

'column_name' => [
    'filter' => 'input', // or your filter class

There is also a generic select input filter. Check it out!