1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-11-29 11:24:10 +01:00

Fix: With scrolling enabled, adding the scrollbar width to the header / footer inner container elements could cause the table to resize incorrectly on the following draw (and this error was cumulative). Fix is not to adjust the inner element for the scrollbar width - makes no difference to the table draw. It is possible that if you've styled this element you might need to take this change into account, but by default DataTables will style the parent (scrollHead) so no change is required (regardless of jQuery UI theming enablement) - 6776.

Fix: The calculation to detect if the scroll bar would be shown in IE6/7 was incorrect - it was calculating the height of the entire table, rather than just the body of the table (i.e. body + header + footer) which caused the "correct" for the scrollbar to be incorrectly applied to small tables.
This commit is contained in:
Allan Jardine 2012-01-30 09:52:35 +00:00
parent 019b235b0e
commit 876a75f6ad
2 changed files with 8 additions and 10 deletions

View File

@ -3127,8 +3127,8 @@
* the scrollbar - which is shouldn't. When there is a scrollbar we need to take this
* into account.
*/
if ( ie67 && (nScrollBody.scrollHeight >
nScrollBody.offsetHeight || $(nScrollBody).css('overflow-y') == "scroll") )
if ( ie67 && ($('tbody', nScrollBody).height() > nScrollBody.offsetHeight ||
$(nScrollBody).css('overflow-y') == "scroll") )
{
o.nTable.style.width = _fnStringToCss( $(o.nTable).outerWidth()-o.oScroll.iBarWidth );
}
@ -3279,7 +3279,6 @@
/*
* 4. Clean up
*/
if ( o.oScroll.sY === "" )
{
/* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting
@ -3307,11 +3306,11 @@
/* Finally set the width's of the header and footer tables */
var iOuterWidth = $(o.nTable).outerWidth();
nScrollHeadTable.style.width = _fnStringToCss( iOuterWidth );
nScrollHeadInner.style.width = _fnStringToCss( iOuterWidth+o.oScroll.iBarWidth );
nScrollHeadInner.style.width = _fnStringToCss( iOuterWidth );
if ( o.nTFoot !== null )
{
nScrollFootInner.style.width = _fnStringToCss( o.nTable.offsetWidth+o.oScroll.iBarWidth );
nScrollFootInner.style.width = _fnStringToCss( o.nTable.offsetWidth );
nScrollFootTable.style.width = _fnStringToCss( o.nTable.offsetWidth );
}

View File

@ -256,8 +256,8 @@ function _fnScrollDraw ( o )
* the scrollbar - which is shouldn't. When there is a scrollbar we need to take this
* into account.
*/
if ( ie67 && (nScrollBody.scrollHeight >
nScrollBody.offsetHeight || $(nScrollBody).css('overflow-y') == "scroll") )
if ( ie67 && ($('tbody', nScrollBody).height() > nScrollBody.offsetHeight ||
$(nScrollBody).css('overflow-y') == "scroll") )
{
o.nTable.style.width = _fnStringToCss( $(o.nTable).outerWidth()-o.oScroll.iBarWidth );
}
@ -408,7 +408,6 @@ function _fnScrollDraw ( o )
/*
* 4. Clean up
*/
if ( o.oScroll.sY === "" )
{
/* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting
@ -436,11 +435,11 @@ function _fnScrollDraw ( o )
/* Finally set the width's of the header and footer tables */
var iOuterWidth = $(o.nTable).outerWidth();
nScrollHeadTable.style.width = _fnStringToCss( iOuterWidth );
nScrollHeadInner.style.width = _fnStringToCss( iOuterWidth+o.oScroll.iBarWidth );
nScrollHeadInner.style.width = _fnStringToCss( iOuterWidth );
if ( o.nTFoot !== null )
{
nScrollFootInner.style.width = _fnStringToCss( o.nTable.offsetWidth+o.oScroll.iBarWidth );
nScrollFootInner.style.width = _fnStringToCss( o.nTable.offsetWidth );
nScrollFootTable.style.width = _fnStringToCss( o.nTable.offsetWidth );
}