1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aoColumns.iDataSort" );
4 $(document).ready( function () {
5 /* Should know that sorting already works by default from other tests, so we can jump
8 var oTable = $('#example').dataTable( {
9 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
19 var oSettings = oTable.fnSettings();
22 "Sorting on first column is uneffected",
24 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
28 "Sorting on second column is the order of the fifth",
29 function () { $('#example thead th:eq(1)').click(); },
30 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
34 "Reserve sorting on second column uses fifth column as well",
35 function () { $('#example thead th:eq(1)').click(); },
36 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
40 "Sorting on 5th column retains it's own sorting",
41 function () { $('#example thead th:eq(4)').click(); },
42 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
47 "Use 2nd col for sorting 5th col and via-versa - no effect on first col sorting",
51 oTable = $('#example').dataTable( {
52 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
63 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
67 "2nd col sorting uses fifth col",
68 function () { $('#example thead th:eq(1)').click(); },
69 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
73 "2nd col sorting uses fifth col - reversed",
74 function () { $('#example thead th:eq(1)').click(); },
75 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
79 "5th col sorting uses 2nd col",
80 function () { $('#example thead th:eq(4)').click(); },
81 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
85 "5th col sorting uses 2nd col - reversed",
86 function () { $('#example thead th:eq(4)').click(); },
87 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1'; }