@@ -1754,7 +1754,8 @@ export class IgxColumnComponent implements AfterContentInit {
1754
1754
*/
1755
1755
public autosize ( byHeader = false ) {
1756
1756
if ( ! this . columnGroup ) {
1757
- this . width = ! byHeader ? this . getLargestCellWidth ( ) : Object . values ( this . getHeaderCellWidths ( ) ) . reduce ( ( a , b ) => a + b ) ;
1757
+ this . width = ! byHeader ? this . getLargestCellWidth ( ) :
1758
+ ( Object . values ( this . getHeaderCellWidths ( ) ) . reduce ( ( a , b ) => a + b ) + 'px' ) ;
1758
1759
this . grid . reflow ( ) ;
1759
1760
}
1760
1761
}
@@ -1792,7 +1793,12 @@ export class IgxColumnComponent implements AfterContentInit {
1792
1793
const headerStyle = this . grid . document . defaultView . getComputedStyle ( this . headerCell . elementRef . nativeElement ) ;
1793
1794
const headerPadding = parseFloat ( headerStyle . paddingLeft ) + parseFloat ( headerStyle . paddingRight ) +
1794
1795
parseFloat ( headerStyle . borderRightWidth ) ;
1795
- return { width : headerWidth , padding : headerPadding } ;
1796
+
1797
+ // Take into consideration the header group element, since column pinning applies borders to it if its not a columnGroup.
1798
+ const headerGroupStyle = this . grid . document . defaultView . getComputedStyle ( this . headerGroup . element . nativeElement ) ;
1799
+ const borderSize = ! this . parent ? parseFloat ( headerGroupStyle . borderRightWidth ) + parseFloat ( headerGroupStyle . borderLeftWidth ) : 0 ;
1800
+
1801
+ return { width : Math . ceil ( headerWidth ) , padding : Math . ceil ( headerPadding + borderSize ) } ;
1796
1802
}
1797
1803
1798
1804
/**
@@ -1821,7 +1827,7 @@ export class IgxColumnComponent implements AfterContentInit {
1821
1827
const index = cellsContentWidths . indexOf ( Math . max ( ...cellsContentWidths ) ) ;
1822
1828
const cellStyle = this . grid . document . defaultView . getComputedStyle ( this . cells [ index ] . nativeElement ) ;
1823
1829
const cellPadding = parseFloat ( cellStyle . paddingLeft ) + parseFloat ( cellStyle . paddingRight ) +
1824
- parseFloat ( cellStyle . borderRightWidth ) ;
1830
+ parseFloat ( cellStyle . borderLeftWidth ) + parseFloat ( cellStyle . borderRightWidth ) ;
1825
1831
1826
1832
largest . set ( Math . max ( ...cellsContentWidths ) , cellPadding ) ;
1827
1833
}
0 commit comments