1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "fnCreatedCell tests" );
4 $(document).ready( function () {
8 $('#example').dataTable( {
10 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
12 fnCreatedCell: function () {
20 "Cell created is called once for each cell on init",
22 function () { return tmp===50; }
26 "Created is called back on other draws",
27 function () { $('#example th:eq(1)').click(); },
28 function () { return tmp===100; }
32 "Four arguments for the function",
38 $('#example').dataTable( {
40 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
42 fnCreatedRow: function () {
43 if ( arguments.length !== 4 ) {
49 fnInitComplete: function () {
54 function () { return (tmp && complete); }
58 "First argument is a TD element",
64 $('#example').dataTable( {
66 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
68 fnCreatedRow: function () {
69 if ( arguments[0].nodeName !== "TD" ) {
75 fnInitComplete: function () {
80 function () { return (tmp && complete); }
84 "Second argument is the HTML value",
90 $('#example').dataTable( {
92 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
94 fnCreatedRow: function () {
95 if ( arguments[1] != $('td').html() ) {
101 fnInitComplete: function () {
106 function () { return (tmp && complete); }
110 "Third argument is the data array",
112 oSession.fnRestore();
116 $('#example').dataTable( {
118 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
120 fnCreatedRow: function () {
121 if ( arguments[2].length !== 5 ) {
127 fnInitComplete: function () {
132 function () { return (tmp && complete); }
136 "Fourth argument is the data source for the row",
138 oSession.fnRestore();
142 $('#example').dataTable( {
144 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
146 fnCreatedRow: function () {
147 if ( arguments[2] !== this.fnSettings().aoData[ arguments[2] ]._aData ) {
153 fnInitComplete: function () {
158 function () { return (tmp && complete); }
162 "Fifth argument is the the col index",
164 oSession.fnRestore();
168 $('#example').dataTable( {
170 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
172 fnCreatedRow: function () {
173 if ( arguments[1] != $('td:eq('+arguments[4]+')', arguments[0].parentNode).html() ) {
179 fnInitComplete: function () {
184 function () { return (tmp && complete); }