@@ -1152,32 +1152,34 @@ class BootstrapTable extends Component {
1152
1152
1153
1153
const scrollBarWidth = isScroll ? Util . getScrollBarWidth ( ) : 0 ;
1154
1154
if ( firstRow && this . store . getDataNum ( ) ) {
1155
- const cells = firstRow . childNodes ;
1156
- for ( let i = 0 ; i < cells . length ; i ++ ) {
1157
- const cell = cells [ i ] ;
1158
- const computedStyle = window . getComputedStyle ( cell ) ;
1159
- let width = parseFloat ( computedStyle . width . replace ( 'px' , '' ) ) ;
1160
- if ( this . isIE ) {
1161
- const paddingLeftWidth = parseFloat ( computedStyle . paddingLeft . replace ( 'px' , '' ) ) ;
1162
- const paddingRightWidth = parseFloat ( computedStyle . paddingRight . replace ( 'px' , '' ) ) ;
1163
- const borderRightWidth = parseFloat ( computedStyle . borderRightWidth . replace ( 'px' , '' ) ) ;
1164
- const borderLeftWidth = parseFloat ( computedStyle . borderLeftWidth . replace ( 'px' , '' ) ) ;
1165
- width = width + paddingLeftWidth + paddingRightWidth + borderRightWidth + borderLeftWidth ;
1166
- }
1167
- const lastPadding = ( cells . length - 1 === i ? scrollBarWidth : 0 ) ;
1168
- if ( width <= 0 ) {
1169
- width = 120 ;
1170
- cell . width = width + lastPadding + 'px' ;
1171
- }
1172
- const result = width + lastPadding + 'px' ;
1173
- header [ i ] . style . width = result ;
1174
- header [ i ] . style . minWidth = result ;
1175
- if ( cells . length - 1 === i ) {
1176
- bodyHeader [ i ] . style . width = width + 'px' ;
1177
- bodyHeader [ i ] . style . minWidth = width + 'px' ;
1178
- } else {
1179
- bodyHeader [ i ] . style . width = result ;
1180
- bodyHeader [ i ] . style . minWidth = result ;
1155
+ if ( isScroll ) {
1156
+ const cells = firstRow . childNodes ;
1157
+ for ( let i = 0 ; i < cells . length ; i ++ ) {
1158
+ const cell = cells [ i ] ;
1159
+ const computedStyle = window . getComputedStyle ( cell ) ;
1160
+ let width = parseFloat ( computedStyle . width . replace ( 'px' , '' ) ) ;
1161
+ if ( this . isIE ) {
1162
+ const paddingLeftWidth = parseFloat ( computedStyle . paddingLeft . replace ( 'px' , '' ) ) ;
1163
+ const paddingRightWidth = parseFloat ( computedStyle . paddingRight . replace ( 'px' , '' ) ) ;
1164
+ const borderRightWidth = parseFloat ( computedStyle . borderRightWidth . replace ( 'px' , '' ) ) ;
1165
+ const borderLeftWidth = parseFloat ( computedStyle . borderLeftWidth . replace ( 'px' , '' ) ) ;
1166
+ width = width + paddingLeftWidth + paddingRightWidth + borderRightWidth + borderLeftWidth ;
1167
+ }
1168
+ const lastPadding = ( cells . length - 1 === i ? scrollBarWidth : 0 ) ;
1169
+ if ( width <= 0 ) {
1170
+ width = 120 ;
1171
+ cell . width = width + lastPadding + 'px' ;
1172
+ }
1173
+ const result = width + lastPadding + 'px' ;
1174
+ header [ i ] . style . width = result ;
1175
+ header [ i ] . style . minWidth = result ;
1176
+ if ( cells . length - 1 === i ) {
1177
+ bodyHeader [ i ] . style . width = width + 'px' ;
1178
+ bodyHeader [ i ] . style . minWidth = width + 'px' ;
1179
+ } else {
1180
+ bodyHeader [ i ] . style . width = result ;
1181
+ bodyHeader [ i ] . style . minWidth = result ;
1182
+ }
1181
1183
}
1182
1184
}
1183
1185
} else {
0 commit comments