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

Fix: When scrolling and row height collapse was enabled, it was possible that the table column width applied would be too small due to the fact that a scrollbar would be shown for a fraction of a second, due to the height of the scroll body container enforced by the scroll collapse. Fix is to take into account the header height before the width calculation is done

This commit is contained in:
Allan Jardine 2012-04-12 17:27:05 +01:00
parent 3a27a605b9
commit 4be9b362c8
3 changed files with 20 additions and 2 deletions

View File

@ -16,7 +16,8 @@
$(document).ready(function() {
$('#example').dataTable( {
"sScrollY": "200px",
"bPaginate": false
"bPaginate": false,
"bScrollCollapse": true
} );
} );
</script>
@ -465,7 +466,8 @@
<pre class="brush: js;">$(document).ready(function() {
$('#example').dataTable( {
"sScrollY": "200px",
"bPaginate": false
"bPaginate": false,
"bScrollCollapse": true
} );
} );</pre>
<style type="text/css">

View File

@ -3113,6 +3113,14 @@
}, nTfootSize.getElementsByTagName('tr') );
}
// If scroll collapse is enabled, when we put the headers back into the body for sizing, we
// will end up forcing the scrollbar to appear, making our measurements wrong for when we
// then hide it (end of this function), so add the header height to the body scroller.
if ( o.oScroll.bCollapse && o.oScroll.sY !== "" )
{
nScrollBody.style.height = (nScrollBody.offsetHeight + o.nTHead.offsetHeight)+"px";
}
/* Size the table as a whole */
iSanityWidth = $(o.nTable).outerWidth();
if ( o.oScroll.sX === "" )

View File

@ -232,6 +232,14 @@ function _fnScrollDraw ( o )
}, nTfootSize.getElementsByTagName('tr') );
}
// If scroll collapse is enabled, when we put the headers back into the body for sizing, we
// will end up forcing the scrollbar to appear, making our measurements wrong for when we
// then hide it (end of this function), so add the header height to the body scroller.
if ( o.oScroll.bCollapse && o.oScroll.sY !== "" )
{
nScrollBody.style.height = (nScrollBody.offsetHeight + o.nTHead.offsetHeight)+"px";
}
/* Size the table as a whole */
iSanityWidth = $(o.nTable).outerWidth();
if ( o.oScroll.sX === "" )