1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "fnCreatedRow tests" );
4 $(document).ready( function () {
8 $('#example').dataTable( {
9 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
10 fnCreatedRow: function () {
16 "Row created is called once for each row on init",
18 function () { return tmp===57; }
22 "Created isn't called back on other draws",
23 function () { $('#example th:eq(1)').click(); },
24 function () { return tmp===57; }
28 "Three arguments for the function",
34 $('#example').dataTable( {
35 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
36 fnCreatedRow: function () {
37 if ( arguments.length !== 3 ) {
41 fnInitComplete: function () {
46 function () { return (tmp && complete); }
50 "First argument is a TR element",
56 $('#example').dataTable( {
57 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
58 fnCreatedRow: function () {
59 if ( arguments[0].nodeName !== "TR" ) {
63 fnInitComplete: function () {
68 function () { return (tmp && complete); }
72 "Second argument is an array with 5 elements",
78 $('#example').dataTable( {
79 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
80 fnCreatedRow: function () {
81 if ( arguments[1].length !== 5 ) {
85 fnInitComplete: function () {
90 function () { return (tmp && complete); }
94 "Third argument is the data source for the row",
100 $('#example').dataTable( {
101 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
102 fnCreatedRow: function () {
103 if ( arguments[1] !== this.fnSettings().aoData[ arguments[2] ]._aData ) {
107 fnInitComplete: function () {
112 function () { return (tmp && complete); }
116 "TR element is tied to the correct data",
118 oSession.fnRestore();
122 $('#example').dataTable( {
123 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
124 fnCreatedRow: function (tr, data, index) {
125 if ( data[1] === "Firefox 1.0" ) {
126 if ( $('td:eq(3)', tr).html() == "1.7" ) {
131 fnInitComplete: function () {
136 function () { return (tmp && complete); }