Skip to content

Instantly share code, notes, and snippets.

View alokkarma's full-sized avatar

Alok Vishwakarma alokkarma

View GitHub Profile
@alokkarma
alokkarma / prime-table.component.html
Created May 4, 2019 19:34
Expand collapse all rows of datatable
<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>