I have angular 4 project with material 2, I want to filter the data in MatTable. DataSource filter is working fine when we filter data on field which are not nested.
<
This is a very generic solution and will work for sure. It does not depends on the structure of json, be it simple or nested, this solution works for all.
this.dataSource.filterPredicate = (data: any, filter) => {
const dataStr =JSON.stringify(data).toLowerCase();
return dataStr.indexOf(filter) != -1;
}