Skip to content

Commit

Permalink
fix(virtual-scroll): create views inside zone
Browse files Browse the repository at this point in the history
fixes #10451
  • Loading branch information
manucorporat committed Apr 19, 2017
1 parent 27cb360 commit fd3c6ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
20 changes: 11 additions & 9 deletions src/components/virtual-scroll/virtual-scroll.ts
Expand Up @@ -501,15 +501,17 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {

adjustRendered(cells, data);

populateNodeData(
data.topCell, data.bottomCell,
data.viewWidth, true,
cells, records, nodes,
this._itmTmp.viewContainer,
this._itmTmp.templateRef,
this._hdrTmp && this._hdrTmp.templateRef,
this._ftrTmp && this._ftrTmp.templateRef, needClean
);
this._zone.run(() => {
populateNodeData(
data.topCell, data.bottomCell,
data.viewWidth, true,
cells, records, nodes,
this._itmTmp.viewContainer,
this._itmTmp.templateRef,
this._hdrTmp && this._hdrTmp.templateRef,
this._ftrTmp && this._ftrTmp.templateRef, needClean,
);
});

if (needClean) {
this._cd.detectChanges();
Expand Down
7 changes: 4 additions & 3 deletions src/components/virtual-scroll/virtual-util.ts
Expand Up @@ -233,9 +233,10 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v
availableNode.cell = cellIndex;

// apply the cell's data to this node
availableNode.view.context.$implicit = cell.data || records[cell.record];
availableNode.view.context.index = cellIndex;
availableNode.view.context.count = recordsLength;
var context = availableNode.view.context;
context.$implicit = cell.data || records[cell.record];
context.index = cellIndex;
context.count = recordsLength;
availableNode.hasChanges = true;
availableNode.lastTransform = null;
hasChanges = true;
Expand Down

0 comments on commit fd3c6ba

Please sign in to comment.