@@ -40,6 +40,28 @@ var PivotView = function (controller, container) {
4040 "c" : { base : undefined , clone : undefined }
4141 } ;
4242
43+ this . SCROLLBAR_WIDTH = ( function ( ) {
44+ var outer = document . createElement ( "div" ) ;
45+ outer . style . visibility = "hidden" ;
46+ outer . style . width = "100px" ;
47+ outer . style . msOverflowStyle = "scrollbar" ;
48+
49+ document . body . appendChild ( outer ) ;
50+
51+ var widthNoScroll = outer . offsetWidth ;
52+ outer . style . overflow = "scroll" ;
53+
54+ var inner = document . createElement ( "div" ) ;
55+ inner . style . width = "100%" ;
56+ outer . appendChild ( inner ) ;
57+
58+ var widthWithScroll = inner . offsetWidth ;
59+
60+ outer . parentNode . removeChild ( outer ) ;
61+
62+ return widthNoScroll - widthWithScroll ;
63+ } ) ( ) ;
64+
4365 this . init ( ) ;
4466
4567} ;
@@ -266,6 +288,7 @@ PivotView.prototype.recalculateSizes = function (container) {
266288 headerH = topHeader . offsetHeight ,
267289 containerHeight = container . offsetHeight ,
268290 mainHeaderWidth = headerContainer . offsetWidth ,
291+ hasVerticalScrollBar = tableBlock . scrollHeight > containerHeight - headerH ,
269292 addExtraTopHeaderCell = tTableHead . offsetWidth > topHeader . offsetWidth ,
270293 addExtraLeftHeaderCell = lTableHead . offsetHeight > containerHeight - headerH ,
271294 cell , tr , cellWidths = [ ] , i ;
@@ -277,6 +300,11 @@ PivotView.prototype.recalculateSizes = function (container) {
277300 }
278301
279302 container . parentNode . removeChild ( container ) ; // detach
303+
304+ if ( hasVerticalScrollBar && cellWidths [ cellWidths . length - 1 ] ) {
305+ cellWidths [ cellWidths . length - 1 ] -= this . SCROLLBAR_WIDTH ;
306+ }
307+
280308 topHeader . style . marginLeft = headerW + "px" ;
281309 tableBlock . style . marginLeft = headerW + "px" ;
282310 leftHeader . style . height = containerHeight - headerH + "px" ;
@@ -299,7 +327,8 @@ PivotView.prototype.recalculateSizes = function (container) {
299327 tr [ "_extraTr" ] = true ;
300328 leftHeader . className = "lpt-leftHeader bordered" ;
301329 cell . colSpan = lTableHead . childNodes . length ;
302- cell . style . paddingTop = headerH + "px" ; // lucky random
330+ cell . textContent = "_" ; // cheating
331+ cell . style . lineHeight = headerH + "px" ; // lucky random
303332 }
304333
305334 for ( i in tableTr . childNodes ) {
0 commit comments