@@ -649,31 +649,24 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
649
649
`.dash-spreadsheet-inner td.dash-delete-cell` ,
650
650
`width: 30px; max-width: 30px; min-width: 30px;`
651
651
) ;
652
- this . stylesheet . setRule (
653
- `.dash-spreadsheet-inner th.dash-delete-header` ,
654
- `width: 30px; max-width: 30px; min-width: 30px;`
655
- ) ;
656
652
}
657
653
658
654
if ( row_selectable ) {
659
655
this . stylesheet . setRule (
660
656
`.dash-spreadsheet-inner td.dash-select-cell` ,
661
657
`width: 30px; max-width: 30px; min-width: 30px;`
662
658
) ;
663
- this . stylesheet . setRule (
664
- `.dash-spreadsheet-inner th.dash-select-header` ,
665
- `width: 30px; max-width: 30px; min-width: 30px;`
666
- ) ;
667
659
}
668
660
669
661
// Adjust the width of the fixed row header
670
662
if ( fixed_rows ) {
671
- Array . from ( r1c1 . querySelectorAll ( 'tr:first-of-type td.dash-cell, tr:first-of-type th.dash-header' ) ) . forEach ( ( td , index ) => {
663
+ Array . from ( r1c1 . querySelectorAll ( 'tr:first-of-type td.dash-cell, tr:first-of-type th.dash-header' ) ) . forEach ( td => {
664
+ const classname = td . className . split ( ' ' ) [ 1 ] ;
672
665
const style = getComputedStyle ( td ) ;
673
666
const width = style . width ;
674
667
675
668
this . stylesheet . setRule (
676
- `.dash-fixed-row:not(.dash-fixed-column) th:nth-of-type( ${ index + 1 } ) ` ,
669
+ `.dash-fixed-row:not(.dash-fixed-column) th. ${ classname } ` ,
677
670
`width: ${ width } !important; min-width: ${ width } !important; max-width: ${ width } !important;`
678
671
) ;
679
672
} ) ;
@@ -682,11 +675,38 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
682
675
// Adjust the width of the fixed row / fixed columns header
683
676
if ( fixed_columns && fixed_rows ) {
684
677
Array . from ( r1c0 . querySelectorAll ( 'tr:first-of-type td.dash-cell, tr:first-of-type th.dash-header' ) ) . forEach ( ( td , index ) => {
678
+ const classname = td . className . split ( ' ' ) [ 1 ] ;
679
+ const style = getComputedStyle ( td ) ;
680
+ const width = style . width ;
681
+
682
+ this . stylesheet . setRule (
683
+ `.dash-fixed-column.dash-fixed-row th.${ classname } ` ,
684
+ `width: ${ width } !important; min-width: ${ width } !important; max-width: ${ width } !important;`
685
+ ) ;
686
+ } ) ;
687
+ }
688
+
689
+ // Adjust widths of row deletable/row selectable headers
690
+ const subTable = fixed_rows && ! fixed_columns ? r1c1 : r1c0 ;
691
+
692
+ if ( row_deletable ) {
693
+ Array . from ( subTable . querySelectorAll ( 'tr:first-of-type td.dash-delete-cell' ) ) . forEach ( td => {
694
+ const style = getComputedStyle ( td ) ;
695
+ const width = style . width ;
696
+
697
+ this . stylesheet . setRule (
698
+ 'th.dash-delete-header' ,
699
+ `width: ${ width } !important; min-width: ${ width } !important; max-width: ${ width } !important;`
700
+ ) ;
701
+ } ) ;
702
+ }
703
+ if ( row_selectable ) {
704
+ Array . from ( subTable . querySelectorAll ( 'tr:first-of-type td.dash-select-cell' ) ) . forEach ( td => {
685
705
const style = getComputedStyle ( td ) ;
686
706
const width = style . width ;
687
707
688
708
this . stylesheet . setRule (
689
- ` .dash-fixed-column.dash-fixed-row th:nth-of-type( ${ index + 1 } )` ,
709
+ 'th .dash-select-header' ,
690
710
`width: ${ width } !important; min-width: ${ width } !important; max-width: ${ width } !important;`
691
711
) ;
692
712
} ) ;
0 commit comments