diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx index a462982e3e..0eb6b2d695 100644 --- a/src/components/Table/Table.tsx +++ b/src/components/Table/Table.tsx @@ -336,6 +336,23 @@ export class Table> extends Rea ); } + private renderColgroup() { + const {columns} = this.props; + const {columnsStyles} = this.state; + + if (!columnsStyles.length) { + return null; + } + + return ( + + {columnsStyles.map(({width}, index) => ( + + ))} + + ); + } + private renderHead() { const {columns, edgePadding, wordWrap} = this.props; const {columnsStyles} = this.state; @@ -351,7 +368,7 @@ export class Table> extends Rea > extends Rea private renderTable() { return ( + {this.renderColgroup()} {this.renderHead()} {this.renderBody()}
@@ -445,7 +463,7 @@ export class Table> extends Rea return ( > extends Rea return style; } + private getCellStyles({ + width: _width, + ...styles + }: React.CSSProperties): React.CSSProperties | undefined { + return Object.keys(styles).length ? styles : undefined; + } + private handleScrollContainerMouseenter = () => { this.setState({activeScrollElement: 'scrollContainer'}); };