annotate DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/fnServerData.js @ 0:ac5f9272033b draft

first upload
author saskia-hiltemann
date Tue, 01 Jul 2014 11:42:23 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 // DATA_TEMPLATE: empty_table
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 oTest.fnStart( "fnServerData for Ajax sourced data" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 $(document).ready( function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 var mPass;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 oTest.fnTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 "Argument length",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 "fnServerData": function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 mPass = arguments.length;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 function () { return mPass == 4; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 oTest.fnTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 "Url",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 "bDestroy": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 "fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 mPass = sUrl == "../../../examples/ajax/sources/arrays.txt";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 function () { return mPass; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 oTest.fnTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 "Data array",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 "bDestroy": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 "fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 mPass = aoData.length==0;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 function () { return mPass; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 oTest.fnTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 "Callback function",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 "bDestroy": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 "fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 mPass = typeof fnCallback == 'function';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 function () { return mPass; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 oTest.fnComplete();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 } );