1 // DATA_TEMPLATE: dom_data
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 var oSettings = oTable.fnSettings();
13 "Default should be null",
15 function () { return oSettings.fnRowCallback == null; }
20 "Four arguments passed",
25 $('#example').dataTable( {
26 "fnRowCallback": function ( nTr ) {
27 mPass = arguments.length;
32 function () { return mPass == 4; }
37 "fnRowCallback called once for each drawn row",
42 $('#example').dataTable( {
43 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
49 function () { return mPass == 10; }
53 "fnRowCallback allows us to alter row information",
56 $('#example').dataTable( {
57 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
58 $(nTr).addClass('unit_test');
63 function () { return $('#example tbody tr:eq(1)').hasClass('unit_test'); }
67 "Data array has length matching columns",
72 $('#example').dataTable( {
73 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
74 if ( asData.length != 5 )
80 function () { return mPass; }
84 "Data array has length matching columns",
90 $('#example').dataTable( {
91 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
92 if ( iCount != iDrawIndex )
99 function () { return mPass; }