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

Table : onLazyLoad event triggered when sorting #15252

Closed
ppaulis opened this issue Apr 10, 2024 · 1 comment
Closed

Table : onLazyLoad event triggered when sorting #15252

ppaulis opened this issue Apr 10, 2024 · 1 comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@ppaulis
Copy link

ppaulis commented Apr 10, 2024

Describe the bug

I'm using the Datatable in lazy mode. When clicking on the p-sortIcon of a column, not ony the (onSort) event is triggered, but also the (onLazyLoad) event. This leads to multiple http calls where only one is necessary. [lazyLoadOnInit]="false" has no effect on this behaviour.

Environment

Angular 15.2.9
PrimeNG 15.4.1

<p-table #dt
             [lazy]="true"
             (onLazyLoad)="tableUpdated($event)"
             [value]="containers"
             dataKey="id"
             [rows]="pageSize"
             [loading]="loading"
             [rowHover]="true"
             [paginator]="true"
             currentPageReportTemplate="Showing {first} to {last} of {totalRecords} Containers"
             [showCurrentPageReport]="true"
             [totalRecords]="totalNbContainers"
             (onSort)="tableSorted($event)"
             [rowsPerPageOptions]="[10,20,25,50,75,100]"
             [lazyLoadOnInit]="false"
    >

Reproducer

No response

Angular version

17.3.4

PrimeNG version

17.13.0

Build / Runtime

TypeScript

Language

TypeScript

Node version (for AoT issues node --version)

18.18.2

Browser(s)

Chrome 123.0.6312.105

Steps to reproduce the behavior

No response

Expected behavior

onLazyLoad event shouldn't be triggered together with onSort when trying to sort a column.

@ppaulis ppaulis added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 10, 2024
@ppaulis
Copy link
Author

ppaulis commented Apr 12, 2024

I figured out, that the onLazyLoad event contains also the sorting information. So I guess, that the onSort event is only necessary for the non-lazy mode. Closing the issue.

@ppaulis ppaulis closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant