Page 1 of 1

LazyLoad on Scroll

Posted: 24 Mar 2020, 08:21
by RKP
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?