1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "bInfiniteScroll" );
5 $(document).ready( function () {
6 var oTable = $('#example').dataTable( {
7 "bScrollInfinite": true,
14 function () { return $('#example tbody tr').length == 10; }
20 function () { return $('#example_info').html() == "Showing 1 to 10 of 57 entries"; }
26 function () { return $('#example tbody>tr').length == 10; }
30 "Scroll on 20px adds 10 rows",
31 function () { $('div.dataTables_scrollBody').scrollTop(20); },
32 function () { return $('#example tbody tr').length == 20; }
36 "Info after 20px scroll",
38 function () { return $('#example_info').html() == "Showing 1 to 20 of 57 entries"; }
42 "Get nodes after 20px scroll",
44 function () { return $('#example tbody>tr').length == 20; }
48 "Scroll on 10px more results in the same number of rows",
49 function () { $('div.dataTables_scrollBody').scrollTop(30); },
50 function () { return $('#example tbody tr').length == 20; }
54 "Info after 10 more px scroll",
56 function () { return $('#example_info').html() == "Showing 1 to 20 of 57 entries"; }
60 "Scroll to 240px adds another 10 rows",
61 function () { $('div.dataTables_scrollBody').scrollTop(240); },
62 function () { return $('#example tbody tr').length == 30; }
66 "Info after 240px scroll",
68 function () { return $('#example_info').html() == "Showing 1 to 30 of 57 entries"; }
72 "Get nodes after 240px scroll",
74 function () { return $('#example tbody>tr').length == 30; }
78 "Filtering will drop back to 10 rows",
80 $('div.dataTables_scrollBody').scrollTop(0);
81 oTable.fnFilter('gec')
83 function () { return $('#example tbody tr').length == 10; }
87 "Info after filtering",
89 function () { return $('#example_info').html() == "Showing 1 to 10 of 20 entries (filtered from 57 total entries)"; }
93 "Get nodes after filtering",
95 function () { return $('#example tbody>tr').length == 10; }
99 "Scroll after filtering adds 10",
100 function () { $('div.dataTables_scrollBody').scrollTop(20); },
101 function () { return $('#example tbody tr').length == 20; }
105 "Get nodes after filtering",
107 function () { return $('#example tbody>tr').length == 20; }
111 "Sorting will drop back to 10 rows",
112 function () { oTable.fnSort([[1,'asc']]) },
113 function () { return $('#example tbody tr').length == 10; }
117 "Scroll after sorting adds 10",
118 function () { $('div.dataTables_scrollBody').scrollTop(20); },
119 function () { return $('#example tbody tr').length == 20; }
123 "Get nodes after scrolling",
125 function () { return $('#example tbody>tr').length == 20; }