1 // DATA_TEMPLATE: js_data
2 oTest.fnStart( "aoColumns.sClass" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable( {
9 var oSettings = oTable.fnSettings();
12 "By default the test class hasn't been applied to the column (sanity!)",
14 function () { return $('#example tbody tr:eq(0) td:eq(2)').hasClass('unittest') == false; }
18 "Add a class to a single column - first row",
21 $('#example').dataTable( {
26 { "sClass": 'unittest' },
32 function () { return $('#example tbody tr:eq(1) td:eq(2)').hasClass('unittest'); }
36 "Add a class to a single column - third row",
38 function () { return $('#example tbody tr:eq(3) td:eq(2)').hasClass('unittest'); }
42 "Add a class to a single column - last row",
44 function () { return $('#example tbody tr:eq(9) td:eq(2)').hasClass('unittest'); }
48 "Add a class to a single column - has not applied to other columns - 1st",
50 function () { return $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest') == false; }
54 "Add a class to a single column - has not applied to other columns - 5th",
56 function () { return $('#example tbody tr:eq(3) td:eq(4)').hasClass('unittest') == false; }
60 "Add a class to a single column - seventh row - second page",
61 function () { $('#example_next').click(); },
62 function () { return $('#example tbody tr:eq(6) td:eq(2)').hasClass('unittest'); }
66 "Add a class to a single column - has not applied to header",
68 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
72 "Add a class to a single column - has not applied to footer",
74 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
79 "Class defined for multiple columns - first row",
82 $('#example').dataTable( {
85 { "sClass": 'unittest2' },
88 { "sClass": 'unittest1' },
95 $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest2') &&
96 $('#example tbody tr:eq(8) td:eq(3)').hasClass('unittest1');
102 "Class defined for multiple columns - has not applied to other columns - 5th 1",
104 function () { return $('#example tbody tr:eq(0) td:eq(4)').hasClass('unittest1') == false; }
108 "Class defined for multiple columns - has not applied to other columns - 5th 2",
110 function () { return $('#example tbody tr:eq(6) td:eq(4)').hasClass('unittest2') == false; }