Skip to content

Commit 238390f

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Update external merge container on data changing.
1 parent e64ee01 commit 238390f

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3859,6 +3859,8 @@ export abstract class IgxGridBaseDirective implements GridType,
38593859
$event.containerSize = this.calcHeight;
38603860
}
38613861
this.evaluateLoadingState();
3862+
this.updateMergedData();
3863+
this.cdr.detectChanges();
38623864
});
38633865

38643866
this.verticalScrollContainer.scrollbarVisibilityChanged.pipe(filter(() => !this._init), destructor).subscribe(() => {
@@ -3882,22 +3884,7 @@ export abstract class IgxGridBaseDirective implements GridType,
38823884
});
38833885

38843886
this.verticalScrollContainer.chunkPreload.pipe(filter(() => !this._init), destructor).subscribe(() => {
3885-
// recalc merged data
3886-
if (this.columnsToMerge.length > 0) {
3887-
const startIndex = this.verticalScrollContainer.state.startIndex;
3888-
const prevDataView = this.verticalScrollContainer.igxForOf?.slice(0, startIndex);
3889-
const data = [];
3890-
for (let index = 0; index < startIndex; index++) {
3891-
const rec = prevDataView[index];
3892-
if (rec.cellMergeMeta &&
3893-
// index + maxRowSpan is within view
3894-
startIndex < (index + Math.max(...rec.cellMergeMeta.values().toArray().map(x => x.rowSpan)))) {
3895-
const visibleIndex = this.isRowPinningToTop ? index + this.pinnedRecordsCount : index;
3896-
data.push({record: rec, index: visibleIndex, dataIndex: index });
3897-
}
3898-
}
3899-
this._mergedDataInView = data;
3900-
}
3887+
this.updateMergedData();
39013888
});
39023889

39033890
// notifier for column autosize requests
@@ -8137,4 +8124,25 @@ export abstract class IgxGridBaseDirective implements GridType,
81378124
return recreateTreeFromFields(value, this._columns) as IFilteringExpressionsTree;
81388125
}
81398126
}
8127+
8128+
private updateMergedData(){
8129+
// recalc merged data
8130+
if (this.columnsToMerge.length > 0) {
8131+
const startIndex = this.verticalScrollContainer.state.startIndex;
8132+
const prevDataView = this.verticalScrollContainer.igxForOf?.slice(0, startIndex);
8133+
const data = [];
8134+
for (let index = 0; index < startIndex; index++) {
8135+
const rec = prevDataView[index];
8136+
if (rec.cellMergeMeta &&
8137+
// index + maxRowSpan is within view
8138+
startIndex < (index + Math.max(...rec.cellMergeMeta.values().toArray().map(x => x.rowSpan)))) {
8139+
const visibleIndex = this.isRowPinningToTop ? index + this.pinnedRecordsCount : index;
8140+
data.push({record: rec, index: visibleIndex, dataIndex: index });
8141+
}
8142+
}
8143+
this._mergedDataInView = data;
8144+
console.log(data);
8145+
//this._activeRowIndexes = null;
8146+
}
8147+
}
81408148
}

0 commit comments

Comments
 (0)