【发布时间】:2018-08-03 04:11:36
【问题描述】:
当用户基于this example 单击它们时,我试图突出显示多行。每次单击一行时,我的 console.log 都会正确输出,这些行永远不会像我预期的样式那样改变颜色。我错过了什么?
我的 HTML
<table datatable [dtOptions]="dtOptionsComp" [dtTrigger]="dtTriggerComp" class="row-border hover">
<thead><tr><th>ID</th><th>Name</th></tr></thead>
<tbody>
<tr *ngFor="let d of companylist" (click)="selectCompany($event, d)" [class.highlighted]="d.highlighted">
<td>{{d.id}}</td><td>{{d.name}}</td>
</tr></tbody>
</table>
我的组件
public selectCompany(event: any, item: any) {
this.selectedCompanyList.push(item.id);
console.log(this.selectedCompanyList+" whee");
item.highlighted=true;
}
我的 CSS
.table tr.highlighted td {
background-color:#123456 !important;
color: white;
}
【问题讨论】:
标签: css angular datatables