1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-18 11:52:11 +01:00

Fixed: The width of the table is now not fixed to the width of the container when scrolling is not applied (this is the same behaviour as 1.6-) - 2530

This commit is contained in:
Allan Jardine 2010-08-21 10:05:07 +01:00
parent 05995bd655
commit 505bfce7c2
3 changed files with 21 additions and 2 deletions

View File

@ -28,7 +28,7 @@
<h1>Live example</h1>
<div id="demo">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example" style="width:80%">
<thead>
<tr>
<th>Rendering engine</th>

View File

@ -5135,6 +5135,10 @@
var nWrapper = oSettings.nTable.parentNode;
nWrapper.appendChild( nCalcTmp );
/* When scrolling (X or Y) we want to set the width of the table as appropriate. However,
* when not scrolling leave the table width as it is. This results in slightly different,
* but I think correct behaviour
*/
if ( oSettings.oScroll.sX !== "" && oSettings.oScroll.sXInner !== "" )
{
nCalcTmp.style.width = _fnStringToCss(oSettings.oScroll.sXInner);
@ -5147,7 +5151,7 @@
nCalcTmp.style.width = _fnStringToCss( nWrapper.offsetWidth );
}
}
else
else if ( oSettings.oScroll.sY !== "" )
{
nCalcTmp.style.width = _fnStringToCss( nWrapper.offsetWidth );
}

View File

@ -0,0 +1,15 @@
// DATA_TEMPLATE: dom_data
oTest.fnStart( "User given with is left when no scrolling" );
$(document).ready( function () {
$('#example')[0].style.width = "80%";
$('#example').dataTable();
oTest.fnTest(
"Check user width is left",
null,
function () { return $('#example').width() == 640; }
);
oTest.fnComplete();
} );