1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "fnDrawCallback" );
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.fnDrawCallback == null; }
29 "One argument passed",
35 $('#example').dataTable( {
36 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
38 { "mData": "engine", "aTargets": [0] },
39 { "mData": "browser", "aTargets": [1] },
40 { "mData": "platform", "aTargets": [2] },
41 { "mData": "version", "aTargets": [3] },
42 { "mData": "grade", "aTargets": [4] }
44 "fnDrawCallback": function ( ) {
45 mPass = arguments.length;
47 "fnInitComplete": function () {
52 function () { return mPass == 1 && bInit; }
57 "That one argument is the settings object",
62 oTable = $('#example').dataTable( {
63 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
65 { "mData": "engine", "aTargets": [0] },
66 { "mData": "browser", "aTargets": [1] },
67 { "mData": "platform", "aTargets": [2] },
68 { "mData": "version", "aTargets": [3] },
69 { "mData": "grade", "aTargets": [4] }
71 "fnDrawCallback": function ( oSettings ) {
74 "fnInitComplete": function () {
79 function () { return oTable.fnSettings() == mPass && bInit; }
83 /* The draw callback is called once for the init and then when the data is added */
85 "fnRowCallback called once on first draw",
91 $('#example').dataTable( {
92 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
94 { "mData": "engine", "aTargets": [0] },
95 { "mData": "browser", "aTargets": [1] },
96 { "mData": "platform", "aTargets": [2] },
97 { "mData": "version", "aTargets": [3] },
98 { "mData": "grade", "aTargets": [4] }
100 "fnDrawCallback": function ( ) {
103 "fnInitComplete": function () {
108 function () { return mPass == 2 && bInit; }
112 "fnRowCallback called once on each draw there after as well",
114 $('#example_next').click();
115 $('#example_next').click();
116 $('#example_next').click();
118 function () { return mPass == 5; }