1 // DATA_TEMPLATE: js_data
2 oTest.fnStart( "fnCreatedRow tests" );
4 $(document).ready( function () {
7 $('#example').dataTable( {
9 fnCreatedRow: function () {
15 "Row created is called once for each row on init",
17 function () { return tmp===57; }
21 "Created isn't called back on other draws",
22 function () { $('#example th:eq(1)').click(); },
23 function () { return tmp===57; }
27 "Three arguments for the function",
32 $('#example').dataTable( {
34 fnCreatedRow: function () {
35 if ( arguments.length !== 3 ) {
41 function () { return tmp; }
45 "First argument is a TR element",
50 $('#example').dataTable( {
52 fnCreatedRow: function () {
53 if ( arguments[0].nodeName !== "TR" ) {
59 function () { return tmp; }
63 "Second argument is an array with 5 elements",
68 $('#example').dataTable( {
70 fnCreatedRow: function () {
71 if ( arguments[1].length !== 5 ) {
77 function () { return tmp; }
81 "Third argument is the data source for the row",
86 $('#example').dataTable( {
88 fnCreatedRow: function () {
89 if ( arguments[1] !== this.fnSettings().aoData[ arguments[2] ]._aData ) {
95 function () { return tmp; }
99 "TR element is tied to the correct data",
101 oSession.fnRestore();
104 $('#example').dataTable( {
106 fnCreatedRow: function (tr, data, index) {
107 if ( data[1] === "Firefox 1.0" ) {
108 if ( $('td:eq(3)', tr).html() == "1.7" ) {
115 function () { return tmp; }