@@ -475,12 +475,22 @@ PivotView.prototype.recalculateSizes = function (container) {
475
475
headerW = leftHeader . offsetWidth ,
476
476
headerH = topHeader . offsetHeight ,
477
477
containerHeight = container . offsetHeight ,
478
+ bodyHeight = containerHeight - headerH - pagedHeight ,
478
479
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 ;
482
483
483
484
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
+
484
494
if ( container [ "_primaryColumns" ] ) {
485
495
for ( i in container [ "_primaryColumns" ] ) {
486
496
cellWidths . push ( container [ "_primaryColumns" ] [ i ] . offsetWidth ) ;
@@ -506,7 +516,14 @@ PivotView.prototype.recalculateSizes = function (container) {
506
516
tableBlock . style . height = containerHeight - headerH - pagedHeight + "px" ;
507
517
headerContainer . style . height = headerH + "px" ;
508
518
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?
510
527
tr = document . createElement ( "tr" ) ;
511
528
tr . appendChild ( cell = document . createElement ( "th" ) ) ;
512
529
lTableHead . appendChild ( tr ) ;
@@ -537,17 +554,6 @@ PivotView.prototype.recalculateSizes = function (container) {
537
554
538
555
containerParent . appendChild ( container ) ; // attach
539
556
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
-
551
557
} catch ( e ) {
552
558
console . error ( "Error when fixing sizes." , "ERROR:" , e ) ;
553
559
}
@@ -651,7 +657,7 @@ PivotView.prototype.renderRawData = function (data) {
651
657
if ( ! rendered || separatelyGrouped ) { // create element
652
658
if ( ! tr ) tr = document . createElement ( "tr" ) ;
653
659
tr . appendChild ( th = document . createElement ( "th" ) ) ;
654
- th . textContent = rawData [ y ] [ x ] . value ;
660
+ th . textContent = rawData [ y ] [ x ] . value || " " ;
655
661
if ( rawData [ y ] [ x ] . style ) th . setAttribute ( "style" , rawData [ y ] [ x ] . style ) ;
656
662
if ( rawData [ y ] [ x ] . className ) th . className = rawData [ y ] [ x ] . className ;
657
663
if ( rawData [ y ] [ x ] . group ) renderedGroups [ rawData [ y ] [ x ] . group ] = {
0 commit comments