@@ -475,12 +475,22 @@ PivotView.prototype.recalculateSizes = function (container) {
475475 headerW = leftHeader . offsetWidth ,
476476 headerH = topHeader . offsetHeight ,
477477 containerHeight = container . offsetHeight ,
478+ bodyHeight = containerHeight - headerH - pagedHeight ,
478479 mainHeaderWidth = headerContainer . offsetWidth ,
479- addExtraLeftHeaderCell = lTableHead . offsetHeight
480- > containerHeight - headerH - pagedHeight && this . SCROLLBAR_WIDTH > 0 ,
481- cell , tr , cellWidths = [ ] , columnHeights = [ ] , i , hasVerticalScrollBar ;
480+ hasVerticalScrollBar = lTableHead . offsetHeight > bodyHeight
481+ && this . SCROLLBAR_WIDTH > 0 ,
482+ cell , tr , cellWidths = [ ] , columnHeights = [ ] , i ;
482483
483484 headerContainer . style . width = headerW + "px" ;
485+ if ( hasVerticalScrollBar && tTableHead . childNodes [ 0 ] ) {
486+ tr = document . createElement ( "th" ) ;
487+ tr . style . minWidth = this . SCROLLBAR_WIDTH + "px" ;
488+ tr . style . width = this . SCROLLBAR_WIDTH + "px" ;
489+ tr . rowSpan = tTableHead . childNodes . length ;
490+ tr [ "_extraCell" ] = true ;
491+ tTableHead . childNodes [ 0 ] . appendChild ( tr ) ;
492+ }
493+
484494 if ( container [ "_primaryColumns" ] ) {
485495 for ( i in container [ "_primaryColumns" ] ) {
486496 cellWidths . push ( container [ "_primaryColumns" ] [ i ] . offsetWidth ) ;
@@ -506,7 +516,14 @@ PivotView.prototype.recalculateSizes = function (container) {
506516 tableBlock . style . height = containerHeight - headerH - pagedHeight + "px" ;
507517 headerContainer . style . height = headerH + "px" ;
508518
509- if ( addExtraLeftHeaderCell ) {
519+ for ( i in container [ "_primaryRows" ] ) {
520+ container [ "_primaryRows" ] [ i ] . style . height = columnHeights [ i ] + "px" ;
521+ }
522+ for ( i in container [ "_primaryColumns" ] ) {
523+ container [ "_primaryColumns" ] [ i ] . style . width = cellWidths [ i ] + "px" ;
524+ }
525+
526+ if ( hasVerticalScrollBar ) { // horScroll?
510527 tr = document . createElement ( "tr" ) ;
511528 tr . appendChild ( cell = document . createElement ( "th" ) ) ;
512529 lTableHead . appendChild ( tr ) ;
@@ -537,17 +554,6 @@ PivotView.prototype.recalculateSizes = function (container) {
537554
538555 containerParent . appendChild ( container ) ; // attach
539556
540- hasVerticalScrollBar = Math . max ( lTableHead . offsetHeight , pTableHead . offsetHeight )
541- > containerHeight - headerH - pagedHeight ;
542- if ( hasVerticalScrollBar && tTableHead . childNodes [ 0 ] ) {
543- tr = document . createElement ( "th" ) ;
544- tr . style . minWidth = this . SCROLLBAR_WIDTH + "px" ;
545- tr . style . width = this . SCROLLBAR_WIDTH + "px" ;
546- tr . rowSpan = tTableHead . childNodes . length ;
547- tr [ "_extraCell" ] = true ;
548- tTableHead . childNodes [ 0 ] . appendChild ( tr ) ;
549- }
550-
551557 } catch ( e ) {
552558 console . error ( "Error when fixing sizes." , "ERROR:" , e ) ;
553559 }
@@ -651,7 +657,7 @@ PivotView.prototype.renderRawData = function (data) {
651657 if ( ! rendered || separatelyGrouped ) { // create element
652658 if ( ! tr ) tr = document . createElement ( "tr" ) ;
653659 tr . appendChild ( th = document . createElement ( "th" ) ) ;
654- th . textContent = rawData [ y ] [ x ] . value ;
660+ th . textContent = rawData [ y ] [ x ] . value || " " ;
655661 if ( rawData [ y ] [ x ] . style ) th . setAttribute ( "style" , rawData [ y ] [ x ] . style ) ;
656662 if ( rawData [ y ] [ x ] . className ) th . className = rawData [ y ] [ x ] . className ;
657663 if ( rawData [ y ] [ x ] . group ) renderedGroups [ rawData [ y ] [ x ] . group ] = {
0 commit comments