@@ -467,28 +467,22 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
467
467
// Render updates if the list of columns have been changed for the header, row, or footer defs.
468
468
this . _renderUpdatedColumns ( ) ;
469
469
470
- let forced = false ;
471
-
472
470
// If the header row definition has been changed, trigger a render to the header row.
473
471
if ( this . _headerRowDefChanged ) {
474
472
this . _forceRenderHeaderRows ( ) ;
475
473
this . _headerRowDefChanged = false ;
476
- forced = true ;
477
474
}
478
475
479
476
// If the footer row definition has been changed, trigger a render to the footer row.
480
477
if ( this . _footerRowDefChanged ) {
481
478
this . _forceRenderFooterRows ( ) ;
482
479
this . _footerRowDefChanged = false ;
483
- forced = true ;
484
480
}
485
481
486
482
// If there is a data source and row definitions, connect to the data source unless a
487
483
// connection has already been made.
488
484
if ( this . dataSource && this . _rowDefs . length > 0 && ! this . _renderChangeSubscription ) {
489
485
this . _observeRenderChanges ( ) ;
490
- } else if ( forced ) {
491
- this . updateStickyColumnStyles ( ) ;
492
486
}
493
487
494
488
this . _checkStickyStates ( ) ;
@@ -797,27 +791,19 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
797
791
*/
798
792
private _renderUpdatedColumns ( ) {
799
793
const columnsDiffReducer = ( acc : boolean , def : BaseRowDef ) => acc || ! ! def . getColumnsDiff ( ) ;
800
- let forced = false ;
801
794
802
795
// Force re-render data rows if the list of column definitions have changed.
803
796
if ( this . _rowDefs . reduce ( columnsDiffReducer , false ) ) {
804
797
this . _forceRenderDataRows ( ) ;
805
- forced = true ;
806
798
}
807
799
808
800
// Force re-render header/footer rows if the list of column definitions have changed..
809
801
if ( this . _headerRowDefs . reduce ( columnsDiffReducer , false ) ) {
810
802
this . _forceRenderHeaderRows ( ) ;
811
- forced = true ;
812
803
}
813
804
814
805
if ( this . _footerRowDefs . reduce ( columnsDiffReducer , false ) ) {
815
806
this . _forceRenderFooterRows ( ) ;
816
- forced = true ;
817
- }
818
-
819
- if ( forced ) {
820
- this . updateStickyColumnStyles ( ) ;
821
807
}
822
808
}
823
809
@@ -888,6 +874,7 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
888
874
889
875
this . _headerRowDefs . forEach ( ( def , i ) => this . _renderRow ( this . _headerRowOutlet , def , i ) ) ;
890
876
this . updateStickyHeaderRowStyles ( ) ;
877
+ this . updateStickyColumnStyles ( ) ;
891
878
}
892
879
/**
893
880
* Clears any existing content in the footer row outlet and creates a new embedded view
@@ -901,6 +888,7 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
901
888
902
889
this . _footerRowDefs . forEach ( ( def , i ) => this . _renderRow ( this . _footerRowOutlet , def , i ) ) ;
903
890
this . updateStickyFooterRowStyles ( ) ;
891
+ this . updateStickyColumnStyles ( ) ;
904
892
}
905
893
906
894
/** Adds the sticky column styles for the rows according to the columns' stick states. */
@@ -1060,6 +1048,7 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
1060
1048
this . _dataDiffer . diff ( [ ] ) ;
1061
1049
this . _rowOutlet . viewContainer . clear ( ) ;
1062
1050
this . renderRows ( ) ;
1051
+ this . updateStickyColumnStyles ( ) ;
1063
1052
}
1064
1053
1065
1054
/**
0 commit comments