1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "sScrollX / Y" );
5 $(document).ready( function () {
6 // Force some x scrolling
7 $('body').css('white-space', 'nowrap');
8 $('#container').css('width', '400px');
10 var oTable = $('#example').dataTable( {
17 "Header follows x-scrolling",
18 function () { $('div.dataTables_scrollBody').scrollLeft(20); },
19 function () { return $('div.dataTables_scrollHead').scrollLeft() == 20; }
23 "Footer follows x-scrolling",
25 function () { return $('div.dataTables_scrollFoot').scrollLeft() == 20; }
29 "y-scrolling has no effect on header",
30 function () { $('div.dataTables_scrollBody').scrollTop(20); },
31 function () { return $('div.dataTables_scrollHead').scrollLeft() == 20; }
35 "Filtering results in sets y-scroll back to 0",
36 function () { oTable.fnFilter('1') },
37 function () { return $('div.dataTables_scrollBody').scrollTop() == 0; }
41 "Filtering has no effect on x-scroll",
43 function () { return $('div.dataTables_scrollBody').scrollLeft() == 20; }
47 "Full x-scroll has header track all the way with it",
49 $('div.dataTables_scrollBody').scrollLeft(
50 $('#example').width() - $('div.dataTables_scrollBody')[0].clientWidth
53 function () { return $('div.dataTables_scrollBody').scrollLeft() == $('div.dataTables_scrollHead').scrollLeft(); }
57 "Footer also tracked all the way",
59 function () { return $('div.dataTables_scrollBody').scrollLeft() == $('div.dataTables_scrollFoot').scrollLeft(); }