Angular 使用角材料表的过滤器
我想知道如何添加一个过滤器到我的表中,使用角度材料,我想过滤器过滤所有列和行,任何帮助将不胜感激,thnx和good day:DAngular 使用角材料表的过滤器,angular,angular-material,Angular,Angular Material,我想知道如何添加一个过滤器到我的表中,使用角度材料,我想过滤器过滤所有列和行,任何帮助将不胜感激,thnx和good day:D <table class="table table-hover"> <thead> <tr> <th scope="col">Rut</th> <th scope="col">Nombre Paciente</th> <th
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Rut</th>
<th scope="col">Nombre Paciente</th>
<th scope="col">Apellido Paciente</th>
<th scope="col">Teléfono</th>
<th scope="col">Dirección</th>
<th scope="col">Acciones</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let pacientes of pacientes">
<td>{{pacientes.rutPac}}</td>
<td>{{pacientes.nombrePac}}</td>
<td>{{pacientes.apellidoPac}}</td>
<td>{{pacientes.telefonoPac}}</td>
<td>{{pacientes.direccionPac}}</td>
<td>
<button class="btn btn-secondary" type="button" href="#updatePaciente" data-toggle="modal" (click)="examenClicked(pacientes)">Editar</button>
<button class="btn btn-danger" (click)="delete(pacientes)">Borrar</button>
</td>
</tr>
</tbody>
</table>
如果您使用的是材质表,则需要提供我们自己的输入字段和自定义函数来过滤数据,以使用MatTableDataSource的filter属性,如前所述 范例
这不是物料表。
<div fxLayout fxLayoutAlign="center center">
<mat-form-field fxFlex="40%">
<input matInput type="text" (keyup)="filterTable($event.target.value)" placeholder="Filter">
</mat-form-field>
</div>
public filterTable = (value: string) => {
this.dataSource.filter = value.trim().toLocaleLowerCase();
}