1 // DATA_TEMPLATE: dom_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( {
17 var oSettings = oTable.fnSettings();
20 "Sorting on first column is uneffected",
22 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
26 "Sorting on second column is the order of the fifth",
27 function () { $('#example thead th:eq(1)').click(); },
28 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
32 "Reserve sorting on second column uses fifth column as well",
33 function () { $('#example thead th:eq(1)').click(); },
34 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
38 "Sorting on 5th column retains it's own sorting",
39 function () { $('#example thead th:eq(4)').click(); },
40 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
45 "Use 2nd col for sorting 5th col and via-versa - no effect on first col sorting",
49 oTable = $('#example').dataTable( {
59 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
63 "2nd col sorting uses fifth col",
64 function () { $('#example thead th:eq(1)').click(); },
65 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
69 "2nd col sorting uses fifth col - reversed",
70 function () { $('#example thead th:eq(1)').click(); },
71 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
75 "5th col sorting uses 2nd col",
76 function () { $('#example thead th:eq(4)').click(); },
77 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
81 "5th col sorting uses 2nd col - reversed",
82 function () { $('#example thead th:eq(4)').click(); },
83 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1'; }