Skip to content

Commit e160c65

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Add handling for variable row height.
1 parent bb4e39f commit e160c65

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid-row.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
}
3333
<ng-template igxGridFor let-col [igxGridForOf]="unpinnedColumns | igxNotGrouped" [igxForScrollContainer]="grid.parentVirtDir" [igxForScrollOrientation]="'horizontal'" [igxForContainerSize]="grid.unpinnedWidth" [igxForSizePropName]="'calcPixelWidth'" [igxForTrackBy]="grid.trackColumnChanges" #igxDirRef>
3434
@if (this.hasMergedCells) {
35-
<div [style.height.px]="getRowHeight()"
35+
<div [style.height.px]=" this.data.cellMergeMeta.get(col.field).rowSpan > 1 ? getRowHeight() : null"
3636
class="igx-grid__mrl-block"
3737
[style.visibility]="this.data.cellMergeMeta.get(col.field).root ? 'hidden' : 'visible'"
3838
[ngStyle]="{
39-
'grid-template-rows':this.getMergeCellSpan(col)
39+
'grid-template-rows': this.data.cellMergeMeta.get(col.field).rowSpan > 1 ? this.getMergeCellSpan(col) : null
4040
}">
4141
<ng-container *ngTemplateOutlet="col.visibleIndex === 0 && grid.hasDetails ? expandableCellTemplate : mergedCellTemplate; context: getContext(col, this)"></ng-container>
4242
</div>

projects/igniteui-angular/src/lib/grids/row.directive.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,11 +599,13 @@ export class IgxRowDirective implements DoCheck, AfterViewInit, OnDestroy {
599599

600600
protected getMergeCellSpan(col: ColumnType){
601601
const rowCount = this.data.cellMergeMeta.get(col.field).rowSpan;
602-
return `repeat(${rowCount},51px)`;
602+
const rowH = this.grid.verticalScrollContainer.getSizeAt(this.index);
603+
return `repeat(${rowCount},${rowH}px)`;
603604
}
604605

605606
protected getRowHeight() {
606-
return this.grid.rowHeight;
607+
const size = this.grid.verticalScrollContainer.getSizeAt(this.index) - 1;
608+
return size || this.grid.rowHeight;
607609
}
608610

609611
/**

src/app/grid-cellMerging/grid-cellMerging.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<h4 class="sample-title">Grid with cell merge</h4>
22
<igx-grid [data]="data" width="800px" height="550px" [moving]="true" [cellMergeMode]="'always'" >
33
<igx-column field="ProductID" header="Product ID" width="200px">
4+
<ng-template igxCell let-cell="cell" let-val>
5+
<div>
6+
<button igxButton>Test</button>
7+
<br/>
8+
<button igxButton>Test 2</button>
9+
</div>
10+
</ng-template>
411
</igx-column>
512
<igx-column field="ReorderLevel" width="200px">
613
</igx-column>

src/app/grid-cellMerging/grid-cellMerging.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Component, HostBinding, ViewChild } from '@angular/core';
22
import { FormsModule } from '@angular/forms';
33
import {
4+
IgxButtonDirective,
5+
IgxCellTemplateDirective,
46
IgxColumnComponent,
57
IgxGridComponent,
68
} from 'igniteui-angular';
@@ -15,6 +17,8 @@ import { data, dataWithoutPK } from '../shared/data';
1517
FormsModule,
1618
IgxColumnComponent,
1719
IgxGridComponent,
20+
IgxCellTemplateDirective,
21+
IgxButtonDirective
1822
]
1923
})
2024
export class GridCellMergingComponent {

0 commit comments

Comments
 (0)