fix(virtualScroll): detect changes in individual nodes

Closes #6137
This commit is contained in:
Adam Bradley
2016-06-08 21:52:45 -05:00
parent b5107cdaf1
commit f049521095
3 changed files with 25 additions and 13 deletions

View File

@ -436,7 +436,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
this._ftrTmp && this._ftrTmp.templateRef, true);
// ******** DOM WRITE ****************
this._cd.detectChanges();
this.detectChanges();
// wait a frame before trying to read and calculate the dimensions
nativeRaf(this.postRenderVirtual.bind(this));
@ -470,6 +470,20 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
);
}
/**
* @private
*/
detectChanges() {
let node: VirtualNode;
for (var i = 0; i < this._nodes.length; i++) {
node = this._nodes[i];
if (node.hasChanges) {
node.view['detectChanges']();
node.hasChanges = false;
}
}
}
/**
* @private
*/
@ -481,14 +495,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
if (this._queue === QUEUE_CHANGE_DETECTION) {
// ******** DOM WRITE ****************
let node: VirtualNode;
for (var i = 0; i < this._nodes.length; i++) {
node = this._nodes[i];
if (node.hasChanges) {
node.view['detectChanges']();
node.hasChanges = false;
}
}
this.detectChanges();
if (this._eventAssist) {
// queue updating node positions in the next frame
@ -573,7 +580,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
adjustRendered(this._cells, this._data);
// ******** DOM WRITE ****************
this._cd.detectChanges();
this.detectChanges();
// ******** DOM WRITE ****************
this.setVirtualHeight(