Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1062,12 +1062,17 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U

for (let i = start; i < end && this.igxForOf[i] !== undefined; i++) {
const embView = this._embeddedViews.shift();
if (!embView.destroyed) {
if (embView && !embView.destroyed) {
this.scrollFocus(embView.rootNodes.find(node => node.nodeType === Node.ELEMENT_NODE)
|| embView.rootNodes[0].nextElementSibling);
const view = container.detach(0);
Comment on lines 1063 to 1068

// embView and view both refer to the same collections
this.updateTemplateContext(embView.context, i);

// Because in Elements the whole parent div (containing data-index) gets removed (possibly due to being disconnected). In Angular it just gets moved.
// This ensures to update it with the new context and remove it first from DOM because of detach action before inserting it manually.
view.detectChanges();

container.insert(view);
Comment on lines +1072 to 1076
this._embeddedViews.push(embView);
}
Expand All @@ -1082,12 +1087,15 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
const container = this.dc.instance._vcr as ViewContainerRef;
for (let i = prevIndex - 1; i >= this.state.startIndex && this.igxForOf[i] !== undefined; i--) {
const embView = this._embeddedViews.pop();
if (!embView.destroyed) {
if (embView && !embView.destroyed) {
this.scrollFocus(embView.rootNodes.find(node => node.nodeType === Node.ELEMENT_NODE)
|| embView.rootNodes[0].nextElementSibling);
// embView and view both refer to the same collections
const view = container.detach(container.length - 1);

Comment on lines 1088 to 1095
this.updateTemplateContext(embView.context, i);
view.detectChanges();

container.insert(view, 0);
this._embeddedViews.unshift(embView);
}
Expand Down
9 changes: 7 additions & 2 deletions projects/igniteui-angular/grids/grid/src/grid.groupby.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ViewChild, TemplateRef, QueryList, ChangeDetectionStrategy } from '@angular/core';
import { Component, ViewChild, TemplateRef, QueryList, ChangeDetectionStrategy } from '@angular/core';
import { formatNumber } from '@angular/common'
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
Expand Down Expand Up @@ -2663,11 +2663,16 @@ describe('IgxGrid - GroupBy #grid', () => {

// scroll down
grid.verticalScrollContainer.getScroll().scrollTop = 10000;
await wait(100); // Triggers onStable
fix.detectChanges();

dataRows = grid.dataRowList.toArray();
// Workaround for await wait triggering onStable prematurely
(grid as any)._restoreVirtState(dataRows[7]);
await wait(100);
fix.detectChanges();

// verify rows are scrolled to the right
dataRows = grid.dataRowList.toArray();
dataRows.forEach(dr => {
Comment on lines +2666 to 2676
const virtualization = dr.virtDirRow;
// should be at last chunk
Expand Down
Loading