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/arrays.txt",
12 { "fnRender": function (a) {
14 return a.aData[a.iDataColumn];
21 var oSettings = oTable.fnSettings();
24 "Single column - fnRender is called once for each row",
26 function () { return mTmp == 57; }
30 "Confirm that fnRender passes two arguments with four parameters",
34 oTable = $('#example').dataTable( {
35 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
39 { "fnRender": function (a) {
40 if ( arguments.length != 2 || typeof a.iDataRow=='undefined' ||
41 typeof a.iDataColumn=='undefined' || typeof a.aData=='undefined' ||
42 typeof a.mDataProp=='undefined' )
46 return a.aData[a.iDataColumn];
54 function () { return mTmp; }
58 "fnRender iDataColumn is row number",
63 oTable = $('#example').dataTable( {
64 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
68 { "fnRender": function (a) {
69 if ( iCount != a.iDataRow )
74 return a.aData[a.iDataColumn];
82 function () { return mTmp; }
86 "fnRender iDataColumn is the column",
90 oTable = $('#example').dataTable( {
91 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
95 { "fnRender": function (a) {
96 if ( a.iDataColumn != 1 )
100 return a.aData[a.iDataColumn];
108 function () { return mTmp; }
112 "fnRender aData is data array of correct size",
115 oSession.fnRestore();
116 oTable = $('#example').dataTable( {
117 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
118 "bDeferRender": true,
121 { "fnRender": function (a) {
122 if ( a.aData.length != 5 )
126 return a.aData[a.iDataColumn];
134 function () { return mTmp; }
138 "Passed back data is put into the DOM",
140 oSession.fnRestore();
141 oTable = $('#example').dataTable( {
142 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
143 "bDeferRender": true,
146 { "fnRender": function (a) {
155 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'unittest'; }
159 "Passed back data is put into the DOM",
161 oSession.fnRestore();
162 oTable = $('#example').dataTable( {
163 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
164 "bDeferRender": true,
168 { "fnRender": function (a) {
171 { "fnRender": function (a) {
180 $('#example tbody tr:eq(0) td:eq(2)').html() == 'unittest1' &&
181 $('#example tbody tr:eq(0) td:eq(3)').html() == 'unittest2';