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:
parent
3a27a605b9
commit
4be9b362c8
@ -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">
|
||||
|
8
media/js/jquery.dataTables.js
vendored
8
media/js/jquery.dataTables.js
vendored
@ -3112,6 +3112,14 @@
|
||||
n.style.width = "";
|
||||
}, 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();
|
||||
|
@ -231,6 +231,14 @@ function _fnScrollDraw ( o )
|
||||
n.style.width = "";
|
||||
}, 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();
|
||||
|
Loading…
Reference in New Issue
Block a user