I am using primeNG in one of my project. I have used Table with sorting from primeNG. I want to used customized icons for sorting.
Any idea how to override the existing primeNG icons.
PrimeNG version - 6.1.4
Create a class for your table like i created test-data:
<p-table #tt [value]="testdata" class="test-data" selectionMode="single" [lazy]="true"
[lazyLoadOnInit] = "false" (onLazyLoad)="loadDataLazily($event)">
<ng-template pTemplate="header">
<tr>
<th *ngFor="let col of cols" [pSortableColumn]="col.header">
{{col.header}}
<p-sortIcon [field]="col.header" ariaLabel="Activate to sort"></p-sortIcon>
</th>
</tr>
</ng-template>
Now override below css in your style.css and use your own content-type code:
.test-data .pi-sort:before {
content: "\02C4"
}
.test-data .pi-sort-down:before {
content: "\02C5";
}
.test-data .pi-sort-up:before {
content: "\e914";
}
It will change the icon of your table where ever you will use class="test-data". More content type code is here content-type-code and here