1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "aoColumns.bSortable" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable();
7 var oSettings = oTable.fnSettings();
10 "All columns are sortable by default",
11 function () { $('#example thead th:eq(1)').click(); },
12 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "All others"; }
16 "Can disable sorting from one column",
19 $('#example').dataTable( {
22 { "bSortable": false },
28 $('#example thead th:eq(1)').click();
30 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() != "All others"; }
34 "Disabled column has no sorting class",
36 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") == false; }
40 "Other columns can still sort",
42 $('#example thead th:eq(4)').click();
43 $('#example thead th:eq(4)').click();
45 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == "X"; }
49 "Disable sorting on multiple columns - no sorting classes",
52 $('#example').dataTable( {
55 { "bSortable": false },
57 { "bSortable": false },
64 $('#example thead th:eq(1)').hasClass("sorting") ||
65 $('#example thead th:eq(3)').hasClass("sorting")
66 return bReturn == false;
71 "Sorting on disabled column 1 has no effect",
73 $('#example thead th:eq(1)').click();
75 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() != "All others"; }
79 "Sorting on disabled column 2 has no effect",
81 $('#example thead th:eq(3)').click();
83 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() != "-"; }
87 "Second sort on disabled column 2 has no effect",
89 $('#example thead th:eq(3)').click();
91 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() != "-"; }
95 "Even with multiple disabled sorting columns other columns can still sort",
97 $('#example thead th:eq(4)').click();
98 $('#example thead th:eq(4)').click();
100 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == "X"; }