Setup: angular 9.1.7, angular-material 9.2.3, macOS 10.14.6, ngrx-store/ngrx-data/ngrx-entity 9.1.2
Situation:
I have a functioning and working material table with a datasource of type MatTableDataSource obtained from an async HTTP request provided by the ngrx Store. I can filter all the properties of Resource itself with the built-in datasource filter function.
Problem:
In my Material table component, I don't show all Resource properties, some columns display related data that is async loaded for the specific resource property, e.g.: {{(element.orderId | orderContactProperty: 'email') | async}} - the resource (element) has an orderId property, and I also load Orders & Contacts from the same server, when at some point, via a pipe the contact for that order of that resource is loaded and a property ('email') of it is presented. Now this obviously doesn't belong to the datasource of type Resource and is loaded later, meaning it can't be filtered.
What would be the best/simplest solution to also filter these lazy loaded properties that do not belong to the original datasource? Basically, how can I filter what the customer sees displayed in the table?
What could work?:
I looked into the mat-table-exporter extension because there only the visible table data is exported and my thought was to extract the rows with all the visible data, then filter, then update the datasource only with the filtered elements but it seems to be a hack-ish workaround, right?
Also I thought about "extending" the datasource by resolving the related properties before displaying and adding them to the respective row so they are now included to be filtered - wouldn't that also be problematic because then the type Resource is not correct anymore and later when I want to edit/update the resources and save them to the server I would have unwanted properties
But before committing my time into any of these ideas, does anyone have an advice/direction how to best solve this problem? I am surely not the first one to stumble upon it but couldn't find any other questions describing that exact scenario
Unfortunately, I can't provide a stackblitz due to the complexity of it and it being a client project, however I hope this screenshot helps to illustrate my problem: (red asterisk means: not in datasource and can't be filtered, the other ones work fine)
