【发布时间】:2019-06-09 05:42:59
【问题描述】:
我正在使用mat-table,我需要在 mat-sort-header 中添加一个自定义图标,但现在如果我点击图标,表格将被排序,我不希望这种行为,这是代码:
<!-- line Column -->
<ng-container matColumnDef="line">
<th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>
line
<span *ngIf="lineFiltered == false; else noFilteredline" (click)="filterLine.toggle($event)" class="filter">
<i class="fa fa-filter" aria-hidden="true"></i></span>
<ng-template #noFilteredline>
<span (click)="filterLine.toggle($event)" class="filter success"
><i class="fa fa-filter" aria-hidden="true"></i
></span>
</ng-template>
</th>
<td mat-cell *matCellDef="let row">{{ row.line }}</td>
</ng-container>
这是排序标题:
如果我把图标放在外面,它就不会出现。
附言我不能使用 event.stopPropagation()
【问题讨论】: