1 // DATA_TEMPLATE: js_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( {
11 var oSettings = oTable.fnSettings();
15 "Default should be null",
17 function () { return oSettings.fnRowCallback == null; }
22 "Four arguments passed",
27 $('#example').dataTable( {
29 "fnRowCallback": function ( nTr ) {
30 mPass = arguments.length;
35 function () { return mPass == 4; }
40 "fnRowCallback called once for each drawn row",
45 $('#example').dataTable( {
47 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
53 function () { return mPass == 10; }
57 "fnRowCallback allows us to alter row information",
60 $('#example').dataTable( {
62 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
63 $(nTr).addClass('unit_test');
68 function () { return $('#example tbody tr:eq(1)').hasClass('unit_test'); }
72 "Data array has length matching columns",
77 $('#example').dataTable( {
79 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
80 if ( asData.length != 5 )
86 function () { return mPass; }
90 "Data array has length matching columns",
96 $('#example').dataTable( {
98 "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
99 if ( iCount != iDrawIndex )
106 function () { return mPass; }