ngx-datatable排序图标
2019-04-18 本文已影响0人
窗外的雪儿飞
- 給ngx-datatable设置css属性
/deep/ .ngx-datatable{
.sortable .sort-btn:before {
font-family: data-table;
content: "c";
}
.sortable .sort-btn.datatable-icon-down:before {
content: "f";
}
.sortable .sort-btn.datatable-icon-up:before {
content: "e";
}
}
- 如果某一列不需要排序,则可设置sortable为false
<ngx-datatable #datatable>
<ngx-datatable-column prop="name" name="name">
<ng-template let-row="row" let-value="value" ngx-datatable-cell-template [sortable]="false">
<span *ngIf="value">{{value}}</span>
</ng-template>
</ngx-datatable-column>
</<ngx-datatable>
- 检索条件重置的时候重置Icon和排序
@ViewChild('datatable') datatable: DatatableComponent;
this.datatable.sorts = [];