@@ -369,8 +369,9 @@ PivotView.prototype.recalculateSizes = function (container) {
369
369
containerHeight = container . offsetHeight ,
370
370
mainHeaderWidth = headerContainer . offsetWidth ,
371
371
hasVerticalScrollBar = tableBlock . scrollHeight > containerHeight - headerH ,
372
- addExtraTopHeaderCell = tTableHead . offsetWidth > topHeader . offsetWidth ,
373
- addExtraLeftHeaderCell = lTableHead . offsetHeight > containerHeight - headerH ,
372
+ //addExtraTopHeaderCell = tTableHead.offsetWidth > topHeader.offsetWidth,
373
+ addExtraLeftHeaderCell = lTableHead . offsetHeight > containerHeight - headerH
374
+ && this . SCROLLBAR_WIDTH > 0 ,
374
375
cell , tr , cellWidths = [ ] , columnHeights = [ ] , i ;
375
376
376
377
headerContainer . style . width = headerW + "px" ;
@@ -403,12 +404,12 @@ PivotView.prototype.recalculateSizes = function (container) {
403
404
tableBlock . style . height = containerHeight - headerH + "px" ;
404
405
headerContainer . style . height = headerH + "px" ;
405
406
406
- if ( addExtraTopHeaderCell ) {
407
- tTableHead . childNodes [ 0 ] . appendChild ( cell = document . createElement ( "th " ) ) ;
408
- cell . rowSpan = tTableHead . childNodes . length ;
409
- cell . style . paddingLeft = headerW + "px" ; // lucky random
410
- cell [ "_extraCell" ] = true ;
411
- }
407
+ // if (false && addExtraTopHeaderCell) {
408
+ // tTableHead.childNodes[0].appendChild(cell = document.createElement("td "));
409
+ // cell.rowSpan = tTableHead.childNodes.length;
410
+ // cell.style.width = this.SCROLLBAR_WIDTH + "px"; // lucky random
411
+ // cell["_extraCell"] = true;
412
+ // }
412
413
413
414
if ( addExtraLeftHeaderCell ) {
414
415
tr = document . createElement ( "tr" ) ;
@@ -421,10 +422,12 @@ PivotView.prototype.recalculateSizes = function (container) {
421
422
if ( cell [ "__i" ] > 5 ) _ [ "_" ] ( ) ;
422
423
} ) ;
423
424
tr [ "_extraTr" ] = true ;
424
- leftHeader . className = "lpt-leftHeader bordered" ;
425
+ leftHeader . className = leftHeader . className . replace ( / \s b o r d e r e d / , "" )
426
+ + " bordered" ;
425
427
cell . colSpan = lTableHead . childNodes . length ;
426
- cell . textContent = "_" ; // cheating
427
- cell . style . lineHeight = headerH + "px" ; // lucky random
428
+ cell . style . height = this . SCROLLBAR_WIDTH + "px" ;
429
+ //cell.textContent = "_"; // cheating
430
+ //cell.style.lineHeight = headerH + "px"; // lucky random
428
431
}
429
432
430
433
for ( i in tableTr . childNodes ) {
@@ -629,13 +632,29 @@ PivotView.prototype.renderRawData = function (data) {
629
632
}
630
633
631
634
tableBlock . addEventListener ( "scroll" , function ( ) {
635
+ if ( tableBlock . _ISE ) { tableBlock . _ISE = false ; return ; }
632
636
topHeader . scrollLeft = tableBlock . scrollLeft ;
633
637
leftHeader . scrollTop = tableBlock . scrollTop ;
638
+ topHeader . _ISE = true ; leftHeader . _ISE = true ; // ignore scroll event
634
639
} ) ;
635
640
636
- tableBlock . className = "lpt-tableBlock" ;
637
641
leftHeader . className = "lpt-leftHeader" ;
638
642
topHeader . className = "lpt-topHeader" ;
643
+ if ( this . controller . CONFIG . enableHeadersScrolling ) {
644
+ leftHeader . className = leftHeader . className + " lpt-scrollable-y" ;
645
+ topHeader . className = topHeader . className + " lpt-scrollable-x" ;
646
+ leftHeader . addEventListener ( "scroll" , function ( ) {
647
+ if ( leftHeader . _ISE ) { leftHeader . _ISE = false ; return ; }
648
+ tableBlock . scrollTop = leftHeader . scrollTop ;
649
+ tableBlock . _ISE = true ;
650
+ } ) ;
651
+ topHeader . addEventListener ( "scroll" , function ( ) {
652
+ if ( topHeader . _ISE ) { topHeader . _ISE = false ; return ; }
653
+ tableBlock . scrollLeft = topHeader . scrollLeft ;
654
+ tableBlock . _ISE = true ;
655
+ } ) ;
656
+ }
657
+ tableBlock . className = "lpt-tableBlock" ;
639
658
pivotHeader . className = "lpt-header" ;
640
659
pivotTopSection . className = "lpt-topSection" ;
641
660
pivotBottomSection . className = "lpt-bottomSection" ;
0 commit comments