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( {
9 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
12 var oSettings = oTable.fnSettings();
16 "Default should be null",
18 function () { return oSettings.fnRowCallback == null; }
23 "Four arguments passed",
28 $('#example').dataTable( {
29 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
31 "fnRowCallback": function ( nTr ) {
32 mPass = arguments.length;
37 function () { return mPass == 4; }
42 "fnRowCallback called once for each drawn row",
47 $('#example').dataTable( {
48 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
50 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
56 function () { return mPass == 10; }
60 "fnRowCallback allows us to alter row information",
63 $('#example').dataTable( {
64 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
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( {
82 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
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( {
102 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
103 "bDeferRender": true,
104 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
105 if ( iCount != iDrawIndex )
112 function () { return mPass; }