我正在尝试在有角度的材质项目的MatTableDataSource中应用过滤器,但我需要忽略用户选择修复的表中的某些行,以使其在应用过滤器后不会消失。我尝试将固定元素直接添加到过滤后的数据属性中,但是修复表的行仍然消失...我该怎么做才能忽略过滤器中的某些行?
这是我尝试过的:
filterInvoiceList(filterValue: string): void {
this.dataSourceInvoice.filter = filterValue.trim().toLowerCase();
this.invoicesFixed.forEach(invoiceFixed => {
var isInvoiceFixedInFilteredInvoices = this.dataSourceInvoice.filteredData.filter(filteredInvoice => filteredInvoice.id === invoiceFixed.id)[0] !== undefined;
if(!isInvoiceFixedInFilteredInvoices){
this.dataSourceInvoice.filteredData.push(invoiceFixed);
}
});
if (this.dataSourceInvoice.paginator) {
this.dataSourceInvoice.paginator.firstPage();
}
}