Skip to content

Commit

Permalink
fix(virtualscroll): Populate nodes at correct height
Browse files Browse the repository at this point in the history
  • Loading branch information
masimplo committed Jan 30, 2017
1 parent eba0866 commit 51c398d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/components/virtual-scroll/virtual-scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
writeUpdate() {
console.debug(`virtual-scroll, writeUpdate`);

processRecords(this._data.renderHeight,
const stopAtHeight = ((this._data.scrollTop || 0) + this._data.renderHeight);
processRecords(stopAtHeight,
this._records,
this._cells,
this._hdrFn,
Expand All @@ -458,16 +459,17 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
const records = this._records;

// initialize nodes with the correct cell data
data.topCell = 0;
adjustRendered(cells, data);
data.bottomCell = (cells.length - 1);

populateNodeData(0, data.bottomCell,
data.viewWidth, true,
cells, records, nodes,
this._itmTmp.viewContainer,
this._itmTmp.templateRef,
this._hdrTmp && this._hdrTmp.templateRef,
this._ftrTmp && this._ftrTmp.templateRef, true);
populateNodeData(data.topCell || 0,
data.bottomCell,
data.viewWidth, true,
cells, records, nodes,
this._itmTmp.viewContainer,
this._itmTmp.templateRef,
this._hdrTmp && this._hdrTmp.templateRef,
this._ftrTmp && this._ftrTmp.templateRef, true);

// ******** DOM WRITE ****************
this._cd.detectChanges();
Expand Down

0 comments on commit 51c398d

Please sign in to comment.