Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class DefaultMergeStrategy implements IGridMergeStrategy {
index++;
continue;
}
const recToUpdateData = recData ?? { recordRef: grid.isGhostRecord(rec) ? rec.recordRef : rec, cellMergeMeta: new Map<string, IMergeByResult>(), ghostRecord: rec.ghostRecord };
const recToUpdateData = recData ?? { recordRef: grid.isGhostRecord(rec) ? rec.recordRef : rec, cellMergeMeta: new Map<string, IMergeByResult>(), ghostRecord: rec.ghostRecord, index: index };
recToUpdateData.cellMergeMeta.set(field, { rowSpan: 1, childRecords: [] });
if (prev && comparer.call(this, prev.recordRef, recToUpdateData.recordRef, field, isDate, isTime) && prev.ghostRecord === recToUpdateData.ghostRecord) {
const root = prev.cellMergeMeta.get(field)?.root ?? prev;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,11 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
protected _differ: IterableDiffer<T> | null = null;
protected _trackByFn: TrackByFunction<T>;
protected individualSizeCache: number[] = [];
/**
* @hidden
*/
/** Internal track for scroll top that is being virtualized */
protected _virtScrollPosition = 0;
public _virtScrollPosition = 0;
/** If the next onScroll event is triggered due to internal setting of scrollTop */
protected _bScrollInternal = false;
// End properties related to virtual height handling
Expand Down Expand Up @@ -867,7 +870,7 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
const maxVirtScrollTop = this._virtSize - containerSize;
this._bScrollInternal = true;
this._virtScrollPosition = maxVirtScrollTop;
this.scrollPosition = maxVirtScrollTop;
this.scrollPosition = maxVirtScrollTop / this._virtRatio;
return;
}
if (this._adjustToIndex) {
Expand Down Expand Up @@ -1470,11 +1473,12 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
let currentScroll = this.scrollPosition;
if (this._virtRatio !== 1) {
this._calcVirtualScrollPosition(this.scrollPosition);
currentScroll = this._virtScrollPosition;
scrollOffset = this.fixedUpdateAllElements(this._virtScrollPosition);
} else {
const scroll = this.scrollComponent.nativeElement;
scrollOffset = scroll && this.scrollComponent.size ?
currentScroll - this.sizesCache[this.state.startIndex] : 0;
}
const scroll = this.scrollComponent.nativeElement;
scrollOffset = scroll && this.scrollComponent.size ?
currentScroll - this.sizesCache[this.state.startIndex] : 0;
const dir = this.igxForScrollOrientation === 'horizontal' ? 'left' : 'top';
this.dc.instance._viewContainer.element.nativeElement.style[dir] = -(scrollOffset) + 'px';
}
Expand Down
20 changes: 10 additions & 10 deletions projects/igniteui-angular/grids/grid/src/grid-base.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3641,7 +3641,7 @@ export abstract class IgxGridBaseDirective implements GridType,

protected getMergeCellOffset(rowData) {
const index = rowData.dataIndex;
let offset = this.verticalScrollContainer.scrollPosition - this.verticalScrollContainer.getScrollForIndex(index);
let offset = this.verticalScrollContainer._virtScrollPosition - this.verticalScrollContainer.getScrollForIndex(index);
if (this.hasPinnedRecords && this.isRowPinningToTop) {
offset -= this.pinnedRowHeight;
}
Expand Down Expand Up @@ -8174,16 +8174,16 @@ export abstract class IgxGridBaseDirective implements GridType,
// recalc merged data
if (this.columnsToMerge.length > 0) {
const startIndex = this.verticalScrollContainer.state.startIndex;
const prevDataView = this.verticalScrollContainer.igxForOf?.slice(0, startIndex);
const data = [];
for (let index = 0; index < startIndex; index++) {
const rec = prevDataView[index];
if (rec.cellMergeMeta &&
// index + maxRowSpan is within view
startIndex < (index + Math.max(...rec.cellMergeMeta.values().toArray().map(x => x.rowSpan)))) {
const visibleIndex = this.isRowPinningToTop ? index + this.pinnedRecordsCount : index;
data.push({ record: rec, index: visibleIndex, dataIndex: index });
}
const rec = this.verticalScrollContainer.igxForOf[startIndex];
if (rec && rec.cellMergeMeta) {
this.columnsToMerge.forEach((col) => {
const root = rec.cellMergeMeta?.get(col.field)?.root;
if (root) {
data.push({ record: root, index: root.index, dataIndex: root.index });
}
})

}
this._mergedDataInView = data;
this.notifyChanges();
Expand Down
6 changes: 3 additions & 3 deletions projects/igniteui-angular/grids/grid/src/grid.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
[IgxScrollInertiaDirection]="this.verticalScrollContainer.dc.instance.scrollDirection">
@for (rowData of mergedDataInView; track rowData.record;) {
<igx-grid-row class="igx-grid__tr--merged-top" [gridID]="id" [index]="rowData.index" [data]="rowData.record.recordRef" [metaData]="rowData.record" [style.top.px]="getMergeCellOffset(rowData)"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowData.index:hasColumnLayouts:isRecordMerged(rowData):false:rowData.record:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowData.index:hasColumnLayouts:hasCellsToMerge:false:rowData.record:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData.record:rowData.index:pipeTrigger" #row>
</igx-grid-row>
}
Expand Down Expand Up @@ -117,13 +117,13 @@
</ng-container>
<ng-template #record_template let-rowIndex="index" let-rowData let-disabledRow="disabled" let-metaData="metaData">
<igx-grid-row [gridID]="id" [index]="rowIndex" [data]="rowData" [disabled]="disabledRow" [metaData]="metaData"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:isRecordMerged(metaData):false:rowData:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:hasCellsToMerge:false:rowData:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData:rowIndex:pipeTrigger" #row>
</igx-grid-row>
</ng-template>
<ng-template #pinned_record_template let-rowIndex="index" let-rowData let-metaData="metaData">
<igx-grid-row [gridID]="id" [index]="rowIndex" [data]="rowData" [metaData]="metaData"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:isRecordMerged(metaData):false:rowData:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:hasCellsToMerge:false:rowData:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData:rowIndex:pipeTrigger"#row #pinnedRow>
</igx-grid-row>
</ng-template>
Expand Down
2 changes: 1 addition & 1 deletion projects/igniteui-angular/grids/grid/src/grid.pipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class IgxGridUnmergeActivePipe implements PipeTransform {
}
let result = cloneArray(collection) as any;
uniqueRoots.forEach(x => {
const index = result.indexOf(x);
const index = x.index;
const colKeys = [...x.cellMergeMeta.keys()];
const cols = colsToMerge.filter(col => colKeys.indexOf(col.field) !== -1);
let res = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
[IgxScrollInertiaDirection]="this.verticalScrollContainer.dc.instance.scrollDirection">
@for (rowData of mergedDataInView; track rowData.record;) {
<igx-hierarchical-grid-row class="igx-grid__tr--merged-top" [gridID]="id" [index]="rowData.index" [data]="rowData.record.recordRef" [metaData]="rowData.record" [style.top.px]="getMergeCellOffset(rowData)"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowData.index:hasColumnLayouts:isRecordMerged(rowData.record):false:rowData.record:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowData.index:hasColumnLayouts:hasCellsToMerge:false:rowData.record:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData.record:rowData.index:pipeTrigger" #row>
</igx-hierarchical-grid-row>
}
Expand Down Expand Up @@ -91,14 +91,14 @@
</ng-template>
<ng-template #hierarchical_record_template let-rowIndex="index" let-disabledRow="disabled" let-rowData let-metaData="metaData">
<igx-hierarchical-grid-row [gridID]="id" [index]="rowIndex" [disabled]="disabledRow" [data]="rowData" [metaData]="metaData"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:isRecordMerged(metaData):false:rowData:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:hasCellsToMerge:false:rowData:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData:rowIndex:pipeTrigger" #row>
</igx-hierarchical-grid-row>
</ng-template>

<ng-template #pinned_hierarchical_record_template let-rowIndex="index" let-rowData let-metaData="metaData">
<igx-hierarchical-grid-row [gridID]="id" [index]="rowIndex" [data]="rowData" [metaData]="metaData"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:isRecordMerged(metaData):false:rowData:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:hasCellsToMerge:false:rowData:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData:rowIndex:pipeTrigger" #row #pinnedRow>
</igx-hierarchical-grid-row>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
[IgxScrollInertiaDirection]="this.verticalScrollContainer.dc.instance.scrollDirection">
@for (rowData of mergedDataInView; track rowData.record;) {
<igx-tree-grid-row class="igx-grid__tr--merged-top" [gridID]="id" [index]="rowData.index" [treeRow]="rowData.record.recordRef" [metaData]="rowData.record" [style.top.px]="getMergeCellOffset(rowData)"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowData.index:hasColumnLayouts:isRecordMerged(rowData):row.treeRow.isFilteredOutParent:rowData:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowData.index:hasColumnLayouts:hasCellsToMerge:row.treeRow.isFilteredOutParent:rowData:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData:rowData.index:pipeTrigger" #row>
</igx-tree-grid-row>
}
Expand Down Expand Up @@ -97,13 +97,13 @@
<ng-container *ngTemplateOutlet="hasPinnedRecords && !isRowPinningToTop ? pinnedRecordsTemplate : null"></ng-container>
<ng-template #record_template let-rowIndex="index" let-disabledRow="disabled" let-rowData let-metaData="metaData">
<igx-tree-grid-row [gridID]="id" [index]="rowIndex" [treeRow]="rowData" [disabled]="disabledRow" [metaData]="metaData"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:isRecordMerged(metaData):row.treeRow.isFilteredOutParent:rowData:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:hasCellsToMerge:row.treeRow.isFilteredOutParent:rowData:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData:rowIndex:pipeTrigger" #row>
</igx-tree-grid-row>
</ng-template>
<ng-template #pinned_record_template let-rowIndex="index" let-rowData let-metaData="metaData">
<igx-tree-grid-row [gridID]="id" [index]="rowIndex" [treeRow]="rowData" [metaData]="metaData"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:isRecordMerged(metaData):row.treeRow.isFilteredOutParent:rowData:pipeTrigger"
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:hasCellsToMerge:row.treeRow.isFilteredOutParent:rowData:pipeTrigger"
[ngStyle]="rowStyles | igxGridRowStyles:rowData:rowIndex:pipeTrigger"#row #pinnedRow>
</igx-tree-grid-row>
</ng-template>
Expand Down
Loading