diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-pivot-table/src/PivotTable.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-pivot-table/src/PivotTable.js index 4b028d04eab3..9c6f8d017f8b 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-pivot-table/src/PivotTable.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-pivot-table/src/PivotTable.js @@ -110,6 +110,10 @@ function PivotTable(element, props) { }); }); + $container.find('table').each(function fullWidth() { + this.style = 'width: 100%'; + }); + if (numGroups === 1) { // When there is only 1 group by column, // we use the DataTable plugin to make the header fixed. diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx b/superset-frontend/temporary_superset_ui/superset-ui/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx index 1483af646daf..92565a565fbc 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx @@ -43,7 +43,7 @@ const Styles = styled.div` ${({ height, width, margin }) => ` margin: ${margin}px; height: ${height - margin * 2}px; - width: ${width - margin * 2}px; + width: ${typeof width === 'string' ? parseInt(width, 10) : width - margin * 2}px; `} `; diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/plugin-chart-pivot-table/src/types.ts b/superset-frontend/temporary_superset_ui/superset-ui/plugins/plugin-chart-pivot-table/src/types.ts index bc068c04394a..004acd44f757 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/plugin-chart-pivot-table/src/types.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/plugin-chart-pivot-table/src/types.ts @@ -31,7 +31,7 @@ import { ColorFormatters } from '@superset-ui/chart-controls'; export interface PivotTableStylesProps { height: number; - width: number; + width: number | string; margin: number; }