1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "fnRowCallback" );
4 /* Note - fnRowCallback MUST return the first arguments (modified or not) */
6 $(document).ready( function () {
7 /* Check the default */
8 var oTable = $('#example').dataTable( {
10 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php"
12 var oSettings = oTable.fnSettings();
16 "Default should be null",
18 function () { return oSettings.fnRowCallback == null; }
23 "Four arguments passed",
28 $('#example').dataTable( {
30 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
31 "fnRowCallback": function ( nTr ) {
32 mPass = arguments.length;
37 function () { return mPass == 4; }
42 "fnRowCallback called once for each drawn row",
47 $('#example').dataTable( {
49 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
50 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
56 function () { return mPass == 10; }
60 "fnRowCallback allows us to alter row information",
63 $('#example').dataTable( {
65 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
66 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
67 $(nTr).addClass('unit_test');
72 function () { return $('#example tbody tr:eq(1)').hasClass('unit_test'); }
76 "Data array has length matching columns",
81 $('#example').dataTable( {
83 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
84 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
85 if ( asData.length != 5 )
91 function () { return mPass; }
95 "Data array has length matching columns",
101 $('#example').dataTable( {
103 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
104 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
105 if ( iCount != iDrawIndex )
112 function () { return mPass; }