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/objects.txt",
10 { "mData": "browser" },
11 { "mData": "platform" },
12 { "mData": "version" },
16 var oSettings = oTable.fnSettings();
19 "By default the test class hasn't been applied to the column (sanity!)",
21 function () { return $('#example tbody tr:eq(0) td:eq(2)').hasClass('unittest') == false; }
25 "Add a class to a single column - first row",
28 $('#example').dataTable( {
29 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
31 { "mData": "engine" },
32 { "mData": "browser" },
33 { "mData": "platform", "sClass": 'unittest' },
34 { "mData": "version" },
39 function () { return $('#example tbody tr:eq(1) td:eq(2)').hasClass('unittest'); }
43 "Add a class to a single column - third row",
45 function () { return $('#example tbody tr:eq(3) td:eq(2)').hasClass('unittest'); }
49 "Add a class to a single column - last row",
51 function () { return $('#example tbody tr:eq(9) td:eq(2)').hasClass('unittest'); }
55 "Add a class to a single column - has not applied to other columns - 1st",
57 function () { return $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest') == false; }
61 "Add a class to a single column - has not applied to other columns - 5th",
63 function () { return $('#example tbody tr:eq(3) td:eq(4)').hasClass('unittest') == false; }
67 "Add a class to a single column - seventh row - second page",
68 function () { $('#example_next').click(); },
69 function () { return $('#example tbody tr:eq(6) td:eq(2)').hasClass('unittest'); }
73 "Add a class to a single column - has not applied to header",
75 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
79 "Add a class to a single column - has not applied to footer",
81 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
86 "Class defined for multiple columns - first row",
89 $('#example').dataTable( {
90 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
92 { "mData": "engine", "sClass": 'unittest2' },
93 { "mData": "browser" },
94 { "mData": "platform" },
95 { "mData": "version", "sClass": 'unittest1' },
102 $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest2') &&
103 $('#example tbody tr:eq(8) td:eq(3)').hasClass('unittest1');
109 "Class defined for multiple columns - has not applied to other columns - 5th 1",
111 function () { return $('#example tbody tr:eq(0) td:eq(4)').hasClass('unittest1') == false; }
115 "Class defined for multiple columns - has not applied to other columns - 5th 2",
117 function () { return $('#example tbody tr:eq(6) td:eq(4)').hasClass('unittest2') == false; }