[FIXED] onRowSelect / onRowClick not getting triggered at all. – Primeng table – Angular


I actually require to traverse to another component with the data selected on click of row. I have been using p-table to perform the same. I have totally no idea why. onRowClick / onRowSelection doesn’t get triggered at all.I even added a console.log string to see if method is atleast called but no it isn’t. Even [(selection)] doesn’t perform well. There’s no problem with p-table since pagination and global filters are actually working well and there’s no issues in it. But this is something i couldn’t figure out why. Primeng version "primeng": "^7.1.3"

<p-table [columns]="cols" [value]="companiesList"  selectionMode="single"
      <ng-template pTemplate="header" let-columns>
              <th *ngFor="let col of columns" [pSortableColumn]="col.field">
                  <p-sortIcon [field]="col.field"></p-sortIcon>
      <ng-template pTemplate="body" let-rowData let-columns="columns">
              <td *ngFor="let col of columns">


Possible alternative solution: in the <tr> tag, add (click)="handleSelect(rowData)" and remove the (onRowClick) handler.


  • If the (onRowClick) binding isn’t working, bind to a different event.
  • The rowData from your let-rowData iteration has the information from the row, which appears to be the information you need to pass to the other component.
  • This approach has been successful for me in the past with a p-table to catch when the user clicks on a row.

Answered By – Philip Antin

Answer Checked By – Clifford M. (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published