Skip to content

Instantly share code, notes, and snippets.

Avatar

Alok Vishwakarma alokkarma

View GitHub Profile
@alokkarma
alokkarma / prime-table.component.html
Created May 4, 2019
Expand collapse all rows of datatable
View prime-table.component.html
<div class="p-grid" style="margin-top:15px; padding:10px;">
<p-table [columns]="cols" [value]="cars" dataKey="vin" [paginator]="true"
[rows]="10" [totalRecords]="cars.length" pageLinkSize="3" (onPage)="onPage($event)"
(onRowExpand)="onRowExpand()" (onRowCollapse)="onRowCollapse()"
[expandedRowKeys]="expandedRows">
<ng-template pTemplate="header" let-columns>
<tr>
<th style="width: 3em">
<a style="cursor: pointer;font-size: 16px; color:teal;" (click)="expandAll()"><i
*ngIf="!isExpanded" class="fa fa-plus-circle" aria-hidden="true"></i>