@@ -369,8 +369,9 @@ PivotView.prototype.recalculateSizes = function (container) {
369369 containerHeight = container . offsetHeight ,
370370 mainHeaderWidth = headerContainer . offsetWidth ,
371371 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 ,
374375 cell , tr , cellWidths = [ ] , columnHeights = [ ] , i ;
375376
376377 headerContainer . style . width = headerW + "px" ;
@@ -403,12 +404,12 @@ PivotView.prototype.recalculateSizes = function (container) {
403404 tableBlock . style . height = containerHeight - headerH + "px" ;
404405 headerContainer . style . height = headerH + "px" ;
405406
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+ // }
412413
413414 if ( addExtraLeftHeaderCell ) {
414415 tr = document . createElement ( "tr" ) ;
@@ -421,10 +422,12 @@ PivotView.prototype.recalculateSizes = function (container) {
421422 if ( cell [ "__i" ] > 5 ) _ [ "_" ] ( ) ;
422423 } ) ;
423424 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" ;
425427 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
428431 }
429432
430433 for ( i in tableTr . childNodes ) {
@@ -629,13 +632,29 @@ PivotView.prototype.renderRawData = function (data) {
629632 }
630633
631634 tableBlock . addEventListener ( "scroll" , function ( ) {
635+ if ( tableBlock . _ISE ) { tableBlock . _ISE = false ; return ; }
632636 topHeader . scrollLeft = tableBlock . scrollLeft ;
633637 leftHeader . scrollTop = tableBlock . scrollTop ;
638+ topHeader . _ISE = true ; leftHeader . _ISE = true ; // ignore scroll event
634639 } ) ;
635640
636- tableBlock . className = "lpt-tableBlock" ;
637641 leftHeader . className = "lpt-leftHeader" ;
638642 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" ;
639658 pivotHeader . className = "lpt-header" ;
640659 pivotTopSection . className = "lpt-topSection" ;
641660 pivotBottomSection . className = "lpt-bottomSection" ;
0 commit comments