Skip to content

Commit f646c61

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Fix by calculating border separately.
1 parent aa86b81 commit f646c61

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,7 +3363,8 @@ export abstract class IgxGridBaseDirective implements GridType,
33633363
private _sortAscendingHeaderIconTemplate: TemplateRef<IgxGridHeaderTemplateContext> = null;
33643364
private _sortDescendingHeaderIconTemplate: TemplateRef<IgxGridHeaderTemplateContext> = null;
33653365
private _gridSize: Size = Size.Large;
3366-
private _defaultRowHeight = 51;
3366+
private _defaultRowHeight = 50;
3367+
private _borderSize = 1;
33673368
private _rowCount: number;
33683369
private _cellMergeMode: GridCellMergeMode = GridCellMergeMode.onSort;
33693370
private _columnsToMerge: IgxColumnComponent[] = [];
@@ -5620,7 +5621,7 @@ export abstract class IgxGridBaseDirective implements GridType,
56205621
*/
56215622
protected get defaultTargetBodyHeight(): number {
56225623
const allItems = this.dataLength;
5623-
return this.renderedRowHeight * Math.min(this._defaultTargetRecordNumber,
5624+
return this.renderedActualRowHeight * Math.min(this._defaultTargetRecordNumber,
56245625
this.paginator ? Math.min(allItems, this.paginator.perPage) : allItems);
56255626
}
56265627

@@ -5629,7 +5630,10 @@ export abstract class IgxGridBaseDirective implements GridType,
56295630
* The rowHeight input is bound to min-height css prop of rows that adds a 1px border in all cases
56305631
*/
56315632
public get renderedRowHeight(): number {
5632-
return this.rowHeight;
5633+
if (this.hasCellsToMerge) {
5634+
return this.rowHeight;
5635+
}
5636+
return this.rowHeight + this._borderSize;
56335637
}
56345638

56355639
/**
@@ -7867,6 +7871,10 @@ export abstract class IgxGridBaseDirective implements GridType,
78677871
this.gridScroll.emit(args);
78687872
}
78697873

7874+
protected get renderedActualRowHeight() {
7875+
return this.rowHeight + this._borderSize;
7876+
}
7877+
78707878
private executeCallback(rowIndex, visibleColIndex = -1, cb: (args: any) => void = null) {
78717879
if (!cb) {
78727880
return;
@@ -8130,12 +8138,19 @@ export abstract class IgxGridBaseDirective implements GridType,
81308138

81318139
protected updateDefaultRowHeight() {
81328140
if (this.dataRowList.length > 0 && this.dataRowList.first.cells && this.dataRowList.first.cells.length > 0) {
8133-
const height = parseFloat(this.document.defaultView.getComputedStyle(this.dataRowList.first.nativeElement)?.getPropertyValue('height'));
8141+
const height = parseFloat(this.document.defaultView.getComputedStyle(this.dataRowList.first.cells.first.nativeElement)?.getPropertyValue('height'));
81348142
if (height) {
81358143
this._defaultRowHeight = height;
81368144
} else {
81378145
this._shouldRecalcRowHeight = true;
81388146
}
8147+
8148+
const rowStyles = this.document.defaultView.getComputedStyle(this.dataRowList.first.nativeElement);
8149+
8150+
const border = rowStyles.borderBottomWidth ? parseFloat(rowStyles.borderBottomWidth) : 1;
8151+
if (border) {
8152+
this._borderSize = border;
8153+
}
81398154
}
81408155
}
81418156

projects/igniteui-angular/src/lib/grids/grid/grid.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
12811281
*/
12821282
protected override get defaultTargetBodyHeight(): number {
12831283
const allItems = this.totalItemCount || this.dataLength;
1284-
return this.renderedRowHeight * Math.min(this._defaultTargetRecordNumber,
1284+
return this.renderedActualRowHeight * Math.min(this._defaultTargetRecordNumber,
12851285
this.paginator ? Math.min(allItems, this.perPage) : allItems);
12861286
}
12871287

0 commit comments

Comments
 (0)