In my material table I use @pipe
to get name instead of position in position row...
I get a name from another JSON file...
<ng-container matColumnDef="position">
<mat-header-cell *matHeaderCellDef> No. </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.position | FilterData }} </mat-cell>
@Pipe({
name: 'FilterData'
})
export class OrdinalPipe implements PipeTransform {
transform(value: Element): string {
var data = ElementTitle.filter(
ElementTitle => ElementTitle.position === value); // ElementTitle is second JSON file
return data[0].name;
}
}
And now when I try to use SEARCH BOX in angular-material table to search by name there is no data, but if I enter position number I get filtered data properly.
Probably, problem is because datatables data is taken from a component but pipe change data in html...
How to TELL mat-table to also search by piped data in table?
Here is working example, try to search by the name (Nitrogen, Helium etc...) https://stackblitz.com/edit/angular-ttg6ux?file=src/app/table-filtering-example.ts
Thnx