mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-10 22:24:10 +01:00
ab9dfd5052
Fix: Table could conitnually expand when x-scrolling was enabled. This was partly addressed in 6776, but the fix was incomplete as it would still occur on Safari Mac (possibly other browsers as well). This fix is very closely related to 8332 (hence commiting together as they are interdependent). Now use padding right on the header/footer wrapper to provide the overflow scroll ability, but only add it when a scrollbar is present - otherwise the width gets added on and we get the forever expanding table. Dev: Unit tests - New tests for scrolling to ensure 6776 and 8332 don't occur again
64 lines
1.8 KiB
JavaScript
Executable File
64 lines
1.8 KiB
JavaScript
Executable File
// DATA_TEMPLATE: 6776
|
|
oTest.fnStart( "Actions on a scrolling table keep width" );
|
|
|
|
|
|
$(document).ready( function () {
|
|
var oTable = $('#example').dataTable( {
|
|
"bFilter": true,
|
|
"bSort": true,
|
|
"sScrollY": "100px",
|
|
"bPaginate": false
|
|
} );
|
|
|
|
var iWidth = $('div.dataTables_wrapper').width();
|
|
|
|
oTest.fnTest(
|
|
"First sort has no effect on width",
|
|
function () { $('th:eq(1)').click(); },
|
|
function () { return $('div.dataTables_wrapper').width() == iWidth; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Second sort has no effect on width",
|
|
function () { $('th:eq(1)').click(); },
|
|
function () { return $('div.dataTables_wrapper').width() == iWidth; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Third sort has no effect on width",
|
|
function () { $('th:eq(2)').click(); },
|
|
function () { return $('div.dataTables_wrapper').width() == iWidth; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Filter has no effect on width",
|
|
function () { oTable.fnFilter('i'); },
|
|
function () { return $('div.dataTables_wrapper').width() == iWidth; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Filter 2 has no effect on width",
|
|
function () { oTable.fnFilter('in'); },
|
|
function () { return $('div.dataTables_wrapper').width() == iWidth; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"No result filter has header and body at same width",
|
|
function () { oTable.fnFilter('xxx'); },
|
|
function () { return $('#example').width() == $('div.dataTables_scrollHeadInner').width(); }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Filter with no results has no effect on width",
|
|
function () { oTable.fnFilter('xxx'); },
|
|
function () { return $('div.dataTables_wrapper').width() == iWidth; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Filter with no results has table equal to wrapper width",
|
|
function () { oTable.fnFilter('xxx'); },
|
|
function () { return $('div.dataTables_wrapper').width() == $('#example').width(); }
|
|
);
|
|
|
|
oTest.fnComplete();
|
|
} ); |