I have a table and I want to add a search box above the table that dynamically searches through the data and filters it to make it easier for users to find what they are looking for.
Here is the code for my table:
<mat-card class="fields-list" *ngIf="tableShown">
<mat-card-content>
<mat-card-actions align="end">
<button type="button" class="topia-btn topia-primary-btn action-buttons" (click)="addClicked()">
Add New Office
</button>
</mat-card-actions>
<mat-table #table [dataSource]="officePinList">
<ng-container cdkColumnDef="label">
<mat-header-cell *cdkHeaderCellDef fxFlex="20%">Label</mat-header-cell>
<mat-cell *cdkCellDef="let officePin" fxFlex="20%">{{officePin.label}}</mat-cell>
</ng-container>
<ng-container cdkColumnDef="postalAddress">
<mat-header-cell *cdkHeaderCellDef fxFlex="55%">Postal Adress</mat-header-cell>
<mat-cell *cdkCellDef="let officePin" fxFlex="55%">{{officePin.postalAddress}}</mat-cell>
</ng-container>
<ng-container cdkColumnDef="trash-icon">
<mat-header-cell *cdkHeaderCellDef fxFlex="15%"></mat-header-cell>
<mat-cell *cdkCellDef="let officePin" fxFlex="15%">
<mat-icon (click)="deleteGroupOffices(officePin.id)" mat-list-icon matTooltip="Delete" class="icon">
delete_forever
</mat-icon>
<mat-icon (click)="editField(officePin.id)" mat-list-icon matTooltip="Edit" class="icon">edit</mat-icon>
</mat-cell>
</ng-container>
<mat-header-row *cdkHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row class="table-row" *cdkRowDef="let officePin; columns: displayedColumns;"></mat-row>
</mat-table>
The data source for my table is officePinList
Is there a way to implement a search filter similar to this example on my table: