I am using primeng p-table
and using the checkbox selector for selecting the rows as follows.
<p-table [value]="data" [paginator]="true" [loading]="loading" [(selection)]="selectedItems" #dt>
<ng-template pTemplate="header">
<tr>
<th style="width: 3rem">
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
</th>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-row>
<td>
<p-tableCheckbox [value]="row"></p-tableCheckbox>
</td>
<td>Column 1</td>
<td>Column 2</td>
</ng-template>
</p-table>
This is working an I am able to select the rows by clicking on the checkbox. But I need to have the following things also.
- Select the row by clicking anywhere on the row(also tick the checkbox)
- Highlight the selected row.
I have checked other options for selecting the rows like Multiple Selection without MetaKey, but it doesn't have a Select All option.
How can I do this ? Any help will be appreciated. Thanks