p-table Lazy Load with Scroll

UI Components for Angular
Post Reply
RKP
Posts: 2
Joined: 24 Mar 2020, 08:10

24 Mar 2020, 16:21

How to achieve lazy loading in p-table with scroll?

I tried to add Lazyloadevent but the event.first and event.rows always return NaN. Also in the page load nothing displays.

am i missing something?

Code:-

<p-table #gbCar class="scy-table"
[value]="cardetails"
scrollable="true"
[scrollHeight]="tableHeight"
(onRowSelect)="onRowSelectCars($event)"
selectionMode="single"
[(selection)]="selectedCar"
[columns]="carcolumns"
(onLazyLoad)="loadCarsLazy($event)"
[virtualScroll]="true"
[lazy]="true"
[totalRecords]="totalRecords"
[virtualRowHeight]="30">


loadCarsLazy(event: LazyLoadEvent) {
//this.loading = true;
if (this.allcars) {
console.log('start ' + +new Date());
console.log(event.first);
console.log(event.rows);
this.cardetails = this.allcars.slice(event.first, (event.first + event.rows));
this._cdr.detectChanges();
console.log('ende ' + +new Date());
}
}

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests