[Table] MatTableDataSource does not execute filter predicate if filter evaluates to false
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
Filter text should not be required for using a filter when a custom filterPredicate is supplied
What is the current behavior?
Filter text must be truthy in order to use a filterPredicate which does not require filter text
What are the steps to reproduce?
Make a filterPredicate which does not depend on the filter value
What is the use-case or motivation for changing an existing behavior?
Filter predicates which do not require the filter text (for example, checking that a value in the data is past the current date)
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Current
Is there anything else we should know?
https://github.com/angular/material2/blob/master/src/lib/table/table-data-source.ts#L213
!this.filter ? data : data.filter(obj => this.filterPredicate(obj, this.filter));
Instead of !this.filter ?
check if a filterPredicate has been supplied
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Angular Material table filterPredicate not invoked
I got this working my moving the filter to where I added the subscription this.subs.add(this.
Read more >Working with mat-table filterPredicate in Angular
mat-table data source filterPredicate function filters the table rows based on the filter string passed to the MatTableDataSource. By default filterPredicate ...
Read more >Angular Material Mat-Table Not Returning Any Results Upon ...
If you want to use filter only specific columns you need to override ... [Table] MatTableDataSource does not execute filter predicate if filter...
Read more >Table | Angular Material
The filtered set of data that has been matched by the filter string, or all the data if there is no filter. Useful...
Read more >ReQL command: filter - RethinkDB
If default is set to false (the default), documents with missing fields ... Predicates to filter are evaluated on the server, and must...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Eddygn
i worked around it this way (ugly)
Somewhat related, when making a custom predicate, if it’s not dependent on the filter string but instead on external flags and the row data, there is no way to trigger the filter itself except to pass some new string to the filter text, even if it’s meaningless. So for now ‘stringifying’ those flags looks like the best option even if the string is not used. I think it will be great if there is a method to call to filter, bypassing the filter change detection, or triggering it manually.