@@ -437,11 +437,9 @@ PivotView.prototype.recalculateSizes = function (container) {
437437 headerH = topHeader . offsetHeight ,
438438 containerHeight = container . offsetHeight ,
439439 mainHeaderWidth = headerContainer . offsetWidth ,
440- hasVerticalScrollBar = Math . max ( lTableHead . offsetHeight , pTableHead . offsetHeight )
441- > containerHeight - headerH - pagedHeight ,
442- addExtraLeftHeaderCell = lTableHead . offsetHeight > containerHeight - headerH - pagedHeight
443- && this . SCROLLBAR_WIDTH > 0 ,
444- cell , tr , cellWidths = [ ] , columnHeights = [ ] , i ;
440+ addExtraLeftHeaderCell = lTableHead . offsetHeight
441+ > containerHeight - headerH - pagedHeight && this . SCROLLBAR_WIDTH > 0 ,
442+ cell , tr , cellWidths = [ ] , columnHeights = [ ] , i , hasVerticalScrollBar ;
445443
446444 headerContainer . style . width = headerW + "px" ;
447445 if ( container [ "_primaryColumns" ] ) {
@@ -461,10 +459,6 @@ PivotView.prototype.recalculateSizes = function (container) {
461459
462460 container . parentNode . removeChild ( container ) ; // detach
463461
464- if ( hasVerticalScrollBar && cellWidths [ cellWidths . length - 1 ] ) {
465- cellWidths [ cellWidths . length - 1 ] -= this . SCROLLBAR_WIDTH ;
466- }
467-
468462 topHeader . style . marginLeft = headerW + "px" ;
469463 tableBlock . style . marginLeft = headerW + "px" ;
470464 leftHeader . style . height = containerHeight - headerH - pagedHeight + "px" ;
@@ -504,6 +498,17 @@ PivotView.prototype.recalculateSizes = function (container) {
504498
505499 containerParent . appendChild ( container ) ; // attach
506500
501+ hasVerticalScrollBar = Math . max ( lTableHead . offsetHeight , pTableHead . offsetHeight )
502+ > containerHeight - headerH - pagedHeight ;
503+ if ( hasVerticalScrollBar && tTableHead . childNodes [ 0 ] ) {
504+ tr = document . createElement ( "th" ) ;
505+ tr . style . minWidth = this . SCROLLBAR_WIDTH + "px" ;
506+ tr . style . width = this . SCROLLBAR_WIDTH + "px" ;
507+ tr . rowSpan = tTableHead . childNodes . length ;
508+ tr [ "_extraCell" ] = true ;
509+ tTableHead . childNodes [ 0 ] . appendChild ( tr ) ;
510+ }
511+
507512 } catch ( e ) {
508513 console . error ( "Error when fixing sizes." , "ERROR:" , e ) ;
509514 }
0 commit comments