LazyLoad on Scroll

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

24 Mar 2020, 08:21

loadCarsLazy(event: LazyLoadEvent) {

if (this.allcars) {

console.log(event.first);
console.log(event.rows);
this.cardetails = this.allcars.slice(event.first, (event.first + event.rows));
this._cdr.detectChanges();
}

}

console.log(event.first);-> Sets to NaN
do i need to explicity specify the value anywhere?

html:-
<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">
<ng-template pTemplate="header">
<tr>
<th style="text-align: center" *ngFor="let col of carcolumns">
{{col.header}}
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-carData>
<tr [pSelectableRow]="carData" style="height:30px">
<td style="text-align:center" *ngFor="let col of carcolumns">
{{carData[col.field]}}
</td>
</tr>
</ng-template>
</p-table>

console.log(event.first);-> Sets to NaN
do i need to explicity specify the value anywhere?

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: MikeZ and 1 guest