1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "fnInitComplete" );
4 /* Fairly boring function compared to the others! */
6 $(document).ready( function () {
7 /* Check the default */
8 var oTable = $('#example').dataTable( {
9 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
11 { "mData": "engine" },
12 { "mData": "browser" },
13 { "mData": "platform" },
14 { "mData": "version" },
18 var oSettings = oTable.fnSettings();
22 "Default should be null",
24 function () { return oSettings.fnInitComplete == null; }
29 "Two arguments passed (for Ajax!)",
34 $('#example').dataTable( {
35 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
37 { "mData": "engine", "aTargets": [0] },
38 { "mData": "browser", "aTargets": [1] },
39 { "mData": "platform", "aTargets": [2] },
40 { "mData": "version", "aTargets": [3] },
41 { "mData": "grade", "aTargets": [4] }
43 "fnInitComplete": function ( ) {
44 mPass = arguments.length;
48 function () { return mPass == 2; }
53 "That one argument is the settings object",
57 oTable = $('#example').dataTable( {
58 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
60 { "mData": "engine", "aTargets": [0] },
61 { "mData": "browser", "aTargets": [1] },
62 { "mData": "platform", "aTargets": [2] },
63 { "mData": "version", "aTargets": [3] },
64 { "mData": "grade", "aTargets": [4] }
66 "fnInitComplete": function ( oSettings ) {
71 function () { return oTable.fnSettings() == mPass; }
76 "fnInitComplete called once on first draw",
81 $('#example').dataTable( {
82 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
84 { "mData": "engine", "aTargets": [0] },
85 { "mData": "browser", "aTargets": [1] },
86 { "mData": "platform", "aTargets": [2] },
87 { "mData": "version", "aTargets": [3] },
88 { "mData": "grade", "aTargets": [4] }
90 "fnInitComplete": function ( ) {
95 function () { return mPass == 1; }
99 "fnInitComplete never called there after",
101 $('#example_next').click();
102 $('#example_next').click();
103 $('#example_next').click();
105 function () { return mPass == 1; }
110 "10 rows in the table on complete",
112 oSession.fnRestore();
115 $('#example').dataTable( {
116 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
118 { "mData": "engine", "aTargets": [0] },
119 { "mData": "browser", "aTargets": [1] },
120 { "mData": "platform", "aTargets": [2] },
121 { "mData": "version", "aTargets": [3] },
122 { "mData": "grade", "aTargets": [4] }
124 "fnInitComplete": function ( ) {
125 mPass = $('#example tbody tr').length;
129 function () { return mPass == 10; }