Currently, I have been storing all my data in a dataSource and using the standard filter for searches. However, I am now interested in performing searches using the "OR" operator.
For example:
{name : john, age : 25, work : driver}
{name : peter, age : 28, work : writer}
{name : james, age : 39, work : athlete}
If I input "john james," I expect the filter function to return line 1 AND line 3.
I believe we need to implement a filterPredicate for this purpose, but I am unsure of how to create/use one. Unfortunately, I have not come across any helpful examples or documentation besides the following prototype:
filterPredicate: ((data: T, filter: string) => boolean);
Does anyone have any ideas or code samples on how to achieve this?
Here is the current version of my function for basic search functionality:
applyFilter(filterValue: string) {
filterValue = filterValue.toLowerCase();
this.dataSource.filter = filterValue;
}