HTML
Code: Select all
<p-table
#dt
[columns] = "cols"
[frozenColumns] = "frozen"
[value] = "permisos"
[autoLayout] = "true"
[paginator] = "true"
[rows] = "5"
[showCurrentPageReport]="true"
currentPageReportTemplate="{first} - {last} de {totalRecords} Registros"
selectionMode="single"
scrollDirection="both"
[scrollable]="true"
[rowsPerPageOptions]="[5,10,20]"
styleClass="p-datatable-sm p-datatable-gridlines"
>
<ng-template pTemplate="header" let-columns let-row="rowIndex">
<tr>
<th *ngFor="let col of cols" [pSortableColumn]="col.field" class="text-center">
{{ col.header }}
<p-sortIcon [field]="col.field"></p-sortIcon>
</th>
</tr>
</ng-template>
</p-table>
TypeScript
Code: Select all
this.cols = {
{field: 'b' , header: 'b'},
{field: 'c' , header: 'c'},
{field: 'd' , header: 'd'},
{field: 'e' , header: 'e'},
{field: 'f' , header: 'f'},
{field: 'g' , header: 'g'},
{field: 'h' , header: 'h'},
}
this.frozen = {
{field: 'a' , header: 'a'},
}