1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aoColumns.sClass" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable( {
7 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
10 var oSettings = oTable.fnSettings();
13 "By default the test class hasn't been applied to the column (sanity!)",
15 function () { return $('#example tbody tr:eq(0) td:eq(2)').hasClass('unittest') == false; }
19 "Add a class to a single column - first row",
22 $('#example').dataTable( {
23 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
28 { "sClass": 'unittest' },
34 function () { return $('#example tbody tr:eq(1) td:eq(2)').hasClass('unittest'); }
38 "Add a class to a single column - third row",
40 function () { return $('#example tbody tr:eq(3) td:eq(2)').hasClass('unittest'); }
44 "Add a class to a single column - last row",
46 function () { return $('#example tbody tr:eq(9) td:eq(2)').hasClass('unittest'); }
50 "Add a class to a single column - has not applied to other columns - 1st",
52 function () { return $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest') == false; }
56 "Add a class to a single column - has not applied to other columns - 5th",
58 function () { return $('#example tbody tr:eq(3) td:eq(4)').hasClass('unittest') == false; }
62 "Add a class to a single column - seventh row - second page",
63 function () { $('#example_next').click(); },
64 function () { return $('#example tbody tr:eq(6) td:eq(2)').hasClass('unittest'); }
68 "Add a class to a single column - has not applied to header",
70 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
74 "Add a class to a single column - has not applied to footer",
76 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
81 "Class defined for multiple columns - first row",
84 $('#example').dataTable( {
85 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
88 { "sClass": 'unittest2' },
91 { "sClass": 'unittest1' },
98 $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest2') &&
99 $('#example tbody tr:eq(8) td:eq(3)').hasClass('unittest1');
105 "Class defined for multiple columns - has not applied to other columns - 5th 1",
107 function () { return $('#example tbody tr:eq(0) td:eq(4)').hasClass('unittest1') == false; }
111 "Class defined for multiple columns - has not applied to other columns - 5th 2",
113 function () { return $('#example tbody tr:eq(6) td:eq(4)').hasClass('unittest2') == false; }