我有一张桌子,我想只显示所选列的插入符号。列的其余部分在单击之前不应显示插入符号 选择 标识符
答案 0 :(得分:0)
我有类似的东西。我使用fontawesome作为插入符号。当客户选择列名称时,插入符号会更改,sortType
将设置为该列名称
<th class="text-center text-nowrap">
<a (click)="onSort('Name')" style="cursor: pointer;">
Customer Name
<span *ngIf="sortType == 'Name' && sortAD == 'Asc'" class="fa fa-caret-down"></span>
<span *ngIf="sortType == 'Name' && sortAD == 'Desc'" class="fa fa-caret-up"></span>
<span *ngIf="sortType != 'Name'" class="fa fa-sort"></span>
</a>
</th>
onSort(columnName: string): void {
if (this.sortAD === 'Asc' && this.sortType === columnName) {
this.sortAD = 'Desc';
}
else {
this.sortAD = 'Asc';
}
this.sortType = columnName;
}