Skip to content

Commit 9ab0996

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Fix auto-size calcs.
1 parent d3e0544 commit 9ab0996

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4599,16 +4599,14 @@ export abstract class IgxGridBaseDirective implements GridType,
45994599
public getHeaderCellWidth(element: HTMLElement): ISizeInfo {
46004600
const range = this.document.createRange();
46014601
const headerWidth = this.platform.getNodeSizeViaRange(range,
4602-
element,
4603-
element.parentElement);
4602+
element, element);
46044603

46054604
const headerStyle = this.document.defaultView.getComputedStyle(element);
46064605
const headerPadding = parseFloat(headerStyle.paddingLeft) + parseFloat(headerStyle.paddingRight) +
46074606
parseFloat(headerStyle.borderRightWidth);
46084607

4609-
// Take into consideration the header group element, since column pinning applies borders to it if its not a columnGroup.
4610-
const headerGroupStyle = this.document.defaultView.getComputedStyle(element.parentElement);
4611-
const borderSize = parseFloat(headerGroupStyle.borderRightWidth) + parseFloat(headerGroupStyle.borderLeftWidth);
4608+
// Take into consideration border since column pinning applies borders to it if its not a columnGroup.
4609+
const borderSize = parseFloat(headerStyle.borderRightWidth) + parseFloat(headerStyle.borderLeftWidth);
46124610
return { width: Math.ceil(headerWidth), padding: Math.ceil(headerPadding + borderSize) };
46134611
}
46144612

projects/igniteui-angular/src/lib/grids/grid/column.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ describe('IgxGrid - Column properties #grid', () => {
259259
expect(item.width).toEqual('200px');
260260
});
261261
const headers = fix.debugElement.queryAll(By.css(COLUMN_HEADER_GROUP_CLASS));
262-
expect(headers[0].nativeElement.style['min-width']).toEqual('200px');
262+
expect(headers[0].nativeElement.clientWidth).toEqual(200);
263263
});
264264

265265
it('headers and cells classes should be correct after scroll horizontal', async () => {

0 commit comments

Comments
 (0)