lazyload event getting triggered multiple times after the use of [virtual Scroll]="true"

UI Components for Angular
Post Reply
Posts: 1
Joined: 30 Nov 2021, 09:00

30 Nov 2021, 09:36

<p-table id="scheGrid" #dt [value]="DetailsList" [columns]="defaultTable.columns.selected"
[(selection)]="selectedDetail" [rowHover]="true"
[filterDelay]="0" editMode="row" sortMode="multiple" [multiSortMeta]="defaultSortCols"
[scrollable]="true" [frozenColumns]="frozenCols" [lazy]="true"
(onLazyLoad)="lazyLoadEvent($event)" [lazyLoadOnInit]="false"
frozenWidth="90px" scrollHeight="350px"
[loading] = "loading"
stateStorage="session" [totalRecords]="totalRecords"

lazyLoadEvent($event) {
this.typingInterval = setTimeout(()=>{
this.searchModel.Filters = $event.filters;
let pageNumber=$event.first/$event.rows+1;
this.searchModel.SortField = $event.sortField;
this.searchModel.SortOrder = $event.sortOrder;
this.searchDetails(); // server call
}, this.doneTypingTimeout);
this.service.getDetails(this.serviceUrl, this.searchModel).subscribe(res=>{
this.DetailsList = res.Details;
this.totalRecords = res.totalRecords;
this.selectedDetail = res[0];
//logic to get table session and assign previously selected record
in this particular grid we actually need multiple sorting ,selection , virtual Scrolling and the grid have some frozen column too.. unable to maintain the selection and get first page record due to unwanted lazy trigger. second page record is visible to the grid during initial load.

Angualr version 10
prime ng "primeng": "^10.0.3"
please support to fix this

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests