1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "fnCreatedCell tests" );
4 $(document).ready( function () {
8 $('#example').dataTable( {
9 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
11 fnCreatedCell: function () {
19 "Cell created is called once for each cell on init",
21 function () { return tmp===285; }
25 "Created isn't called back on other draws",
26 function () { $('#example th:eq(1)').click(); },
27 function () { return tmp===285; }
31 "Four arguments for the function",
37 $('#example').dataTable( {
38 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
40 fnCreatedRow: function () {
41 if ( arguments.length !== 4 ) {
47 fnInitComplete: function () {
52 function () { return (tmp && complete); }
56 "First argument is a TD element",
62 $('#example').dataTable( {
63 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
65 fnCreatedRow: function () {
66 if ( arguments[0].nodeName !== "TD" ) {
72 fnInitComplete: function () {
77 function () { return (tmp && complete); }
81 "Second argument is the HTML value",
87 $('#example').dataTable( {
88 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
90 fnCreatedRow: function () {
91 if ( arguments[1] != $('td').html() ) {
97 fnInitComplete: function () {
102 function () { return (tmp && complete); }
106 "Third argument is the data array",
108 oSession.fnRestore();
112 $('#example').dataTable( {
113 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
115 fnCreatedRow: function () {
116 if ( arguments[2].length !== 5 ) {
122 fnInitComplete: function () {
127 function () { return (tmp && complete); }
131 "Fourth argument is the data source for the row",
133 oSession.fnRestore();
137 $('#example').dataTable( {
138 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
140 fnCreatedRow: function () {
141 if ( arguments[2] !== this.fnSettings().aoData[ arguments[2] ]._aData ) {
147 fnInitComplete: function () {
152 function () { return (tmp && complete); }
156 "Fifth argument is the the col index",
158 oSession.fnRestore();
162 $('#example').dataTable( {
163 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
165 fnCreatedRow: function () {
166 if ( arguments[1] != $('td:eq('+arguments[4]+')', arguments[0].parentNode).html() ) {
172 fnInitComplete: function () {
177 function () { return (tmp && complete); }