@@ -43,6 +43,22 @@ export default class TableScrollbar extends React.Component {
4343 this . renderFixedHeader ( ) ;
4444 }
4545
46+ handleScroll ( ) {
47+ this . tableclone . style . top = this . container . scrollTop + "px" ;
48+ }
49+
50+ handleResize ( ) {
51+ // Copy the columns width from the table to the clone.
52+ let columns = this . table . getElementsByTagName ( "th" ) ;
53+ let cloneColumns = this . tableclone . getElementsByTagName ( "th" ) ;
54+ for ( let i = 0 ; i < columns . length ; i ++ ) {
55+ let width = columns [ i ] . clientWidth + "px" ;
56+ cloneColumns [ i ] . style . minWidth = width ;
57+ cloneColumns [ i ] . style . width = width ;
58+ cloneColumns [ i ] . style . boxSizing = "border-box" ;
59+ }
60+ }
61+
4662 renderFixedHeader ( ) {
4763 // Remove previous table clone from the DOM.
4864 if ( this . tableclone !== null ) {
@@ -112,22 +128,6 @@ export default class TableScrollbar extends React.Component {
112128 </ div >
113129 ) ;
114130 }
115-
116- handleScroll ( ) {
117- this . tableclone . style . top = this . container . scrollTop + "px" ;
118- }
119-
120- handleResize ( ) {
121- // Copy the columns width from the table to the clone.
122- let columns = this . table . getElementsByTagName ( "th" ) ;
123- let cloneColumns = this . tableclone . getElementsByTagName ( "th" ) ;
124- for ( let i = 0 ; i < columns . length ; i ++ ) {
125- let width = columns [ i ] . clientWidth + "px" ;
126- cloneColumns [ i ] . style . minWidth = width ;
127- cloneColumns [ i ] . style . width = width ;
128- cloneColumns [ i ] . style . boxSizing = "border-box" ;
129- }
130- }
131131}
132132
133133TableScrollbar . propTypes = propTypes ;
0 commit comments