components icon indicating copy to clipboard operation
components copied to clipboard

Data table multiple filters

Open lukejoliat opened this issue 8 years ago • 5 comments

I'm aware of the ability to create a custom filter with the .filterPredicate method. But I'm not aware of any way to have multiple filters on the same table that all interact with one another.

For instance, I want to filter just title down to a certain number of options, and then filter among those remaining options by date.

Currently, when I filter by title, that looks for matches among all the data, and then when I search for date it essentially clears title and searches for matches among all the data again, and not the recently filtered set.

Does anyone know of a way to accomplish this?

lukejoliat avatar Mar 06 '18 16:03 lukejoliat

That use case sounds a little more specific than MatTableDataSource could be. Have you tried implementing your own DataSource? You'll have full control of any filtering mechanism you want.

willshowell avatar Mar 06 '18 18:03 willshowell

Alternatively avoid using the MatTableDataSource filter entirely and just manually filter the data you provide to the data source.

Closing since there's no issue, but feel free to continue the discussion if you'd like to bounce ideas around.

andrewseguin avatar Mar 06 '18 22:03 andrewseguin

Thank you for your prompt replies!

lukejoliat avatar Mar 07 '18 02:03 lukejoliat

@lukejoliat What solution did you end up using because I've been looking all day and there is absolutely nothing. I tried using a pipe and it broke the pagination.

srukali avatar Apr 26 '18 00:04 srukali

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.