1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "aoColumns.fnRender" );
4 $(document).ready( function () {
5 /* Check the default */
7 var oTable = $('#example').dataTable( {
10 { "fnRender": function (a) {
12 return a.aData[a.iDataColumn];
19 var oSettings = oTable.fnSettings();
22 "Single column - fnRender is called once for each row",
24 function () { return mTmp == 57; }
28 "Confirm that fnRender passes two arguments with four parameters",
32 oTable = $('#example').dataTable( {
35 { "fnRender": function (a, v) {
36 if ( arguments.length != 2 || typeof a.iDataRow=='undefined' ||
37 typeof a.iDataColumn=='undefined' || typeof a.aData=='undefined' ||
38 typeof a.mDataProp=='undefined' )
42 return a.aData[a.iDataColumn];
50 function () { return mTmp; }
54 "fnRender iDataColumn is row number",
59 oTable = $('#example').dataTable( {
62 { "fnRender": function (a) {
63 if ( iCount != a.iDataRow )
68 return a.aData[a.iDataColumn];
76 function () { return mTmp; }
80 "fnRender iDataColumn is the column",
84 oTable = $('#example').dataTable( {
87 { "fnRender": function (a) {
88 if ( a.iDataColumn != 1 )
92 return a.aData[a.iDataColumn];
100 function () { return mTmp; }
104 "fnRender aData is data array of correct size",
107 oSession.fnRestore();
108 oTable = $('#example').dataTable( {
111 { "fnRender": function (a) {
112 if ( a.aData.length != 5 )
116 return a.aData[a.iDataColumn];
124 function () { return mTmp; }
128 "Passed back data is put into the DOM",
130 oSession.fnRestore();
131 oTable = $('#example').dataTable( {
134 { "fnRender": function (a) {
143 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'unittest'; }
147 "Passed back data is put into the DOM",
149 oSession.fnRestore();
150 oTable = $('#example').dataTable( {
154 { "fnRender": function (a) {
157 { "fnRender": function (a) {
166 $('#example tbody tr:eq(0) td:eq(2)').html() == 'unittest1' &&
167 $('#example tbody tr:eq(0) td:eq(3)').html() == 'unittest2';