1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aoColumns.fnRender" );
4 $(document).ready( function () {
5 /* Check the default */
7 var oTable = $('#example').dataTable( {
8 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
10 { "mData": "engine" },
13 "fnRender": function (a) {
15 return a.aData['browser'];
18 { "mData": "platform" },
19 { "mData": "version" },
23 var oSettings = oTable.fnSettings();
26 "Single column - fnRender is called twice for each row",
28 function () { return mTmp == 57; }
32 "Confirm that fnRender passes two arguments with four parameters",
36 oTable = $('#example').dataTable( {
37 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
39 { "mData": "engine" },
41 "fnRender": function (a) {
42 if ( arguments.length != 2 || typeof a.iDataRow=='undefined' ||
43 typeof a.iDataColumn=='undefined' || typeof a.aData=='undefined' ||
44 typeof a.mData=='undefined' )
48 return a.aData['browser'];
52 { "mData": "platform" },
53 { "mData": "version" },
58 function () { return mTmp; }
62 "fnRender iDataColumn is the column",
66 oTable = $('#example').dataTable( {
67 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
69 { "mData": "engine" },
72 "fnRender": function (a) {
73 if ( a.iDataColumn != 1 )
77 return a.aData['browser'];
80 { "mData": "platform" },
81 { "mData": "version" },
86 function () { return mTmp; }
90 "fnRender aData is data array of correct size",
94 oTable = $('#example').dataTable( {
95 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
97 { "mData": "engine" },
100 "fnRender": function (a) {
101 if ( a.aData.length != 5 )
105 return a.aData['browser'];
108 { "mData": "platform" },
109 { "mData": "version" },
114 function () { return mTmp; }
118 "Passed back data is put into the DOM",
120 oSession.fnRestore();
121 oTable = $('#example').dataTable( {
122 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
124 { "mData": "engine" },
127 "fnRender": function (a) {
131 { "mData": "platform" },
132 { "mData": "version" },
137 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'unittest'; }
141 "Passed back data is put into the DOM",
143 oSession.fnRestore();
144 oTable = $('#example').dataTable( {
145 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
147 { "mData": "engine" },
148 { "mData": "browser" },
151 "fnRender": function (a) {
157 "fnRender": function (a) {
167 $('#example tbody tr:eq(0) td:eq(2)').html() == 'unittest1' &&
168 $('#example tbody tr:eq(0) td:eq(3)').html() == 'unittest2';