I have this ngx-datatable
for Angular that doesn't support filter by column. I would like to add an input filter for every column (some are strings, some are multiple choices etc) and combine them to a single filter so I can use it to get data with rxJs
from the backend.
What I have for now:
This is the filter component on every column header:
<div class="input-group mb">
<div class="input-group-addon">
<span class="input-group-text" id="search-addon"><em class="icon-magnifier"></em></span>
</div>
<input aria-describedby="search-addon" id="order_id" aria-label="Customer" placeholder="Search" class="form-control" type="text" (keyup)='updateFilter($event)'>
</div>
The update filter function
updateFilter(event) {
let columnName = event.currentTarget.id;
const val = event.target.value.toString().toLowerCase();
const filteredData = this.temp.filter(function(d) {
return d[columnName].toString().toLowerCase().indexOf(val) !== -1 || !val;
});
this.rows= filteredData;
this.table.offset = 0;
}
This works for every column. But how can I combine all the filters and start observing the API response?