0
|
1 // DATA_TEMPLATE: empty_table
|
|
2 oTest.fnStart( "fnInitComplete" );
|
|
3
|
|
4 /* Fairly boring function compared to the others! */
|
|
5
|
|
6 $(document).ready( function () {
|
|
7 /* Check the default */
|
|
8 var oTable = $('#example').dataTable( {
|
|
9 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
10 "bDeferRender": true
|
|
11 } );
|
|
12 var oSettings = oTable.fnSettings();
|
|
13 var mPass;
|
|
14
|
|
15 oTest.fnWaitTest(
|
|
16 "Default should be null",
|
|
17 null,
|
|
18 function () { return oSettings.fnInitComplete == null; }
|
|
19 );
|
|
20
|
|
21
|
|
22 oTest.fnWaitTest(
|
|
23 "Two arguments passed (for Ajax!)",
|
|
24 function () {
|
|
25 oSession.fnRestore();
|
|
26
|
|
27 mPass = -1;
|
|
28 $('#example').dataTable( {
|
|
29 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
30 "bDeferRender": true,
|
|
31 "fnInitComplete": function ( ) {
|
|
32 mPass = arguments.length;
|
|
33 }
|
|
34 } );
|
|
35 },
|
|
36 function () { return mPass == 2; }
|
|
37 );
|
|
38
|
|
39
|
|
40 oTest.fnWaitTest(
|
|
41 "That one argument is the settings object",
|
|
42 function () {
|
|
43 oSession.fnRestore();
|
|
44
|
|
45 oTable = $('#example').dataTable( {
|
|
46 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
47 "bDeferRender": true,
|
|
48 "fnInitComplete": function ( oSettings ) {
|
|
49 mPass = oSettings;
|
|
50 }
|
|
51 } );
|
|
52 },
|
|
53 function () { return oTable.fnSettings() == mPass; }
|
|
54 );
|
|
55
|
|
56
|
|
57 oTest.fnWaitTest(
|
|
58 "fnInitComplete called once on first draw",
|
|
59 function () {
|
|
60 oSession.fnRestore();
|
|
61
|
|
62 mPass = 0;
|
|
63 $('#example').dataTable( {
|
|
64 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
65 "bDeferRender": true,
|
|
66 "fnInitComplete": function ( ) {
|
|
67 mPass++;
|
|
68 }
|
|
69 } );
|
|
70 },
|
|
71 function () { return mPass == 1; }
|
|
72 );
|
|
73
|
|
74 oTest.fnWaitTest(
|
|
75 "fnInitComplete never called there after",
|
|
76 function () {
|
|
77 $('#example_next').click();
|
|
78 $('#example_next').click();
|
|
79 $('#example_next').click();
|
|
80 },
|
|
81 function () { return mPass == 1; }
|
|
82 );
|
|
83
|
|
84
|
|
85 oTest.fnWaitTest(
|
|
86 "10 rows in the table on complete",
|
|
87 function () {
|
|
88 oSession.fnRestore();
|
|
89
|
|
90 mPass = 0;
|
|
91 $('#example').dataTable( {
|
|
92 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
93 "bDeferRender": true,
|
|
94 "fnInitComplete": function ( ) {
|
|
95 mPass = $('#example tbody tr').length;
|
|
96 }
|
|
97 } );
|
|
98 },
|
|
99 function () { return mPass == 10; }
|
|
100 );
|
|
101
|
|
102
|
|
103
|
|
104 oTest.fnComplete();
|
|
105 } ); |