Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove onRowClick from Table #5037

Closed
cagataycivici opened this issue Feb 1, 2018 · 2 comments
Closed

Remove onRowClick from Table #5037

cagataycivici opened this issue Feb 1, 2018 · 2 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@cagataycivici
Copy link
Member

It is redundant as it can easily be done with <tr (click)

@cagataycivici cagataycivici added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Feb 1, 2018
@cagataycivici cagataycivici added this to the 5.2.0-Final milestone Feb 1, 2018
@cagataycivici cagataycivici self-assigned this Feb 1, 2018
@wz2b
Copy link

wz2b commented May 17, 2018

It is NOT redundant. Row selection is NOT the same as generic "click" event. A row selection is supposed to send you back the model (the content of the row). Click sends you back a MouseEvent.

@bossqone
Copy link
Contributor

@wz2b You can bind click event on tr element in table.

<p-table [columns]="cols" [value]="cars">
    <ng-template pTemplate="header" let-columns>
        <tr>
            <th *ngFor="let col of columns">
                {{col.header}}
            </th>
        </tr>
    </ng-template>
    <ng-template pTemplate="body" let-rowData let-columns="columns">
        <tr (click)="onRowClick($event, rowData)">   <!-- like this -->
            <td *ngFor="let col of columns">
                    {{rowData[col.field]}}
            </td>
        </tr>
    </ng-template>
</p-table>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

3 participants