1 // DATA_TEMPLATE: deferred_table
4 oTest.fnStart( "Defer loading tests" );
6 $(document).ready( function () {
7 var gotServerData = false;
9 $('#example').dataTable( {
12 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
13 "fnServerData": function (url, data, fn) {
17 "success": function(json) {
28 "10 rows shown on the first page",
30 function () { return $('#example tbody tr').length == 10; }
34 "No request to the server yet",
36 function () { return !gotServerData; }
40 "Information on zero config",
42 function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; }
46 "Initial data order retained",
48 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
52 "Initial data order retained 2",
54 function () { return $('#example tbody td:eq(1)').html() == "Firefox 1.0"; }
58 "Still no request to the server yet",
60 function () { return !gotServerData; }
64 "Sorting (first click) on second column",
65 function () { $('#example thead th:eq(1)').click(); },
66 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
70 "Now we've had a request",
72 function () { return gotServerData; }
76 "Information after sort",
78 function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; }
82 "Sorting (second click) on second column",
83 function () { $('#example thead th:eq(1)').click(); },
84 function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
88 "Sorting (third click) on second column",
89 function () { $('#example thead th:eq(1)').click(); },
90 function () { return $('#example tbody td:eq(1)').html() == "All others"; }