I am using p-table along with checkboxes for rowSelection. On Selection Of every checkbox I need to Call API And fetch Data. Below is my code for Declaring table. On Check of row, event is triggered multiple Times, IdeallY it should trigger only On Check and uncheck of check box. Also I have To ensure That my row selection should happen on clicking anywhere in the row as well(using ). In below Code (selectionChange) event is Triggered multiple Times.
<p-table #table [columns]="DemoArray" [value]="DemoData" [rows]="10" [lazy]="true"
dataKey="ID" styleClass="styleClassName" class="styleClassName"
[multiSortMeta]="[{field: 'origin', order: 1}]" (onLazyLoad)="lazyLoad($event)"
[selection]="SelectedData" [totalRecords]="totalRecord"
(selectionChange)="onSelectionChange($event)" (selectAllChange)="onSelectAllChange($event)"
scrollHeight="380px" [scrollable]="true"
[virtualScroll]="true" [virtualRowHeight]="50">