1 // DATA_TEMPLATE: js_data
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( {
18 var oSettings = oTable.fnSettings();
21 "Sorting on first column is uneffected",
23 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
27 "Sorting on second column is the order of the fifth",
28 function () { $('#example thead th:eq(1)').click(); },
29 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
33 "Reserve sorting on second column uses fifth column as well",
34 function () { $('#example thead th:eq(1)').click(); },
35 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
39 "Sorting on 5th column retains it's own sorting",
40 function () { $('#example thead th:eq(4)').click(); },
41 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
46 "Use 2nd col for sorting 5th col and via-versa - no effect on first col sorting",
50 oTable = $('#example').dataTable( {
61 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
65 "2nd col sorting uses fifth col",
66 function () { $('#example thead th:eq(1)').click(); },
67 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
71 "2nd col sorting uses fifth col - reversed",
72 function () { $('#example thead th:eq(1)').click(); },
73 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
77 "5th col sorting uses 2nd col",
78 function () { $('#example thead th:eq(4)').click(); },
79 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
83 "5th col sorting uses 2nd col - reversed",
84 function () { $('#example thead th:eq(4)').click(); },
85 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1'; }