1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "fnCreatedRow tests" );
4 $(document).ready( function () {
8 $('#example').dataTable( {
10 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
11 fnCreatedRow: function () {
17 "Row created is called once for each row on init",
19 function () { return tmp===10; }
23 "Created is called back on other draws",
24 function () { $('#example th:eq(1)').click(); },
25 function () { return tmp===20; }
29 "Three arguments for the function",
35 $('#example').dataTable( {
37 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
38 fnCreatedRow: function () {
39 if ( arguments.length !== 3 ) {
43 fnInitComplete: function () {
48 function () { return (tmp && complete); }
52 "First argument is a TR element",
58 $('#example').dataTable( {
60 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
61 fnCreatedRow: function () {
62 if ( arguments[0].nodeName !== "TR" ) {
66 fnInitComplete: function () {
71 function () { return (tmp && complete); }
75 "Second argument is an array with 5 elements",
81 $('#example').dataTable( {
83 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
84 fnCreatedRow: function () {
85 if ( arguments[1].length !== 5 ) {
89 fnInitComplete: function () {
94 function () { return (tmp && complete); }
98 "Third argument is the data source for the row",
100 oSession.fnRestore();
104 $('#example').dataTable( {
106 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
107 fnCreatedRow: function () {
108 if ( arguments[1] !== this.fnSettings().aoData[ arguments[2] ]._aData ) {
112 fnInitComplete: function () {
117 function () { return (tmp && complete); }
121 "TR element is tied to the correct data",
123 oSession.fnRestore();
127 $('#example').dataTable( {
129 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
130 fnCreatedRow: function (tr, data, index) {
131 if ( data[1] === "Firefox 1.0" ) {
132 if ( $('td:eq(3)', tr).html() == "1.7" ) {
137 fnInitComplete: function () {
142 function () { return (tmp && complete); }