Skip to content

Commit 51c398d

Browse files
committed
fix(virtualscroll): Populate nodes at correct height
1 parent eba0866 commit 51c398d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/components/virtual-scroll/virtual-scroll.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
432432
writeUpdate() {
433433
console.debug(`virtual-scroll, writeUpdate`);
434434

435-
processRecords(this._data.renderHeight,
435+
const stopAtHeight = ((this._data.scrollTop || 0) + this._data.renderHeight);
436+
processRecords(stopAtHeight,
436437
this._records,
437438
this._cells,
438439
this._hdrFn,
@@ -458,16 +459,17 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
458459
const records = this._records;
459460

460461
// initialize nodes with the correct cell data
461-
data.topCell = 0;
462+
adjustRendered(cells, data);
462463
data.bottomCell = (cells.length - 1);
463464

464-
populateNodeData(0, data.bottomCell,
465-
data.viewWidth, true,
466-
cells, records, nodes,
467-
this._itmTmp.viewContainer,
468-
this._itmTmp.templateRef,
469-
this._hdrTmp && this._hdrTmp.templateRef,
470-
this._ftrTmp && this._ftrTmp.templateRef, true);
465+
populateNodeData(data.topCell || 0,
466+
data.bottomCell,
467+
data.viewWidth, true,
468+
cells, records, nodes,
469+
this._itmTmp.viewContainer,
470+
this._itmTmp.templateRef,
471+
this._hdrTmp && this._hdrTmp.templateRef,
472+
this._ftrTmp && this._ftrTmp.templateRef, true);
471473

472474
// ******** DOM WRITE ****************
473475
this._cd.detectChanges();

0 commit comments

Comments
 (0)