1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aoColumns.bSortable" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable( {
8 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php"
10 var oSettings = oTable.fnSettings();
13 "All columns are sortable by default",
14 function () { $('#example thead th:eq(1)').click(); },
15 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "All others"; }
19 "Can disable sorting from one column",
22 $('#example').dataTable( {
24 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
27 { "bSortable": false },
33 $('#example thead th:eq(1)').click();
35 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Firefox 1.0"; }
39 "Disabled column has no sorting class",
41 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") == false; }
45 "Other columns can still sort",
47 $('#example thead th:eq(4)').click();
48 $('#example thead th:eq(4)').click();
50 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 4.0"; }
54 "Disable sorting on multiple columns - no sorting classes",
57 $('#example').dataTable( {
59 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
62 { "bSortable": false },
64 { "bSortable": false },
71 $('#example thead th:eq(1)').hasClass("sorting") ||
72 $('#example thead th:eq(3)').hasClass("sorting")
73 return bReturn == false;
78 "Sorting on disabled column 1 has no effect",
80 $('#example thead th:eq(1)').click();
82 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Firefox 1.0"; }
86 "Sorting on disabled column 2 has no effect",
88 $('#example thead th:eq(3)').click();
90 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Firefox 1.0"; }
94 "Second sort on disabled column 2 has no effect",
96 $('#example thead th:eq(3)').click();
98 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Firefox 1.0"; }
102 "Even with multiple disabled sorting columns other columns can still sort",
104 $('#example thead th:eq(4)').click();
105 $('#example thead th:eq(4)').click();
107 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 4.0"; }