1 // DATA_TEMPLATE: js_data
2 oTest.fnStart( "aoColumns.fnRender" );
4 $(document).ready( function () {
5 /* Check the default */
7 var oTable = $('#example').dataTable( {
11 { "fnRender": function (a) {
13 return a.aData[a.iDataColumn];
20 var oSettings = oTable.fnSettings();
23 "Single column - fnRender is called once for each row",
25 function () { return mTmp == 57; }
29 "Confirm that fnRender passes two arguments with four parameters",
33 oTable = $('#example').dataTable( {
37 { "fnRender": function (a) {
38 if ( arguments.length != 2 || typeof a.iDataRow=='undefined' ||
39 typeof a.iDataColumn=='undefined' || typeof a.aData=='undefined' ||
40 typeof a.mDataProp=='undefined' )
44 return a.aData[a.iDataColumn];
52 function () { return mTmp; }
56 "fnRender iDataColumn is the column",
60 oTable = $('#example').dataTable( {
64 { "fnRender": function (a) {
65 if ( a.iDataColumn != 1 )
69 return a.aData[a.iDataColumn];
77 function () { return mTmp; }
81 "fnRender aData is data array of correct size",
85 oTable = $('#example').dataTable( {
89 { "fnRender": function (a) {
90 if ( a.aData.length != 5 )
94 return a.aData[a.iDataColumn];
102 function () { return mTmp; }
106 "Passed back data is put into the DOM",
108 oSession.fnRestore();
109 oTable = $('#example').dataTable( {
113 { "fnRender": function (a) {
122 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'unittest'; }
126 "Passed back data is put into the DOM",
128 oSession.fnRestore();
129 oTable = $('#example').dataTable( {
134 { "fnRender": function (a) {
137 { "fnRender": function (a) {
146 $('#example tbody tr:eq(0) td:eq(2)').html() == 'unittest1' &&
147 $('#example tbody tr:eq(0) td:eq(3)').html() == 'unittest2';