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:
parent
05995bd655
commit
505bfce7c2
@ -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>
|
||||
|
6
media/js/jquery.dataTables.js
vendored
6
media/js/jquery.dataTables.js
vendored
@ -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 );
|
||||
}
|
||||
|
15
media/unit_testing/tests_onhold/1_dom/2530-2.js
Executable file
15
media/unit_testing/tests_onhold/1_dom/2530-2.js
Executable 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();
|
||||
} );
|
Loading…
x
Reference in New Issue
Block a user