1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "aaSortingFixed" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
/* Check the default */ |
6 |
var oTable = $('#example').dataTable( { |
7 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt" |
8 |
} ); |
9 |
var oSettings = oTable.fnSettings(); |
10 |
|
11 |
oTest.fnWaitTest( |
12 |
"No fixed sorting by default", |
13 |
null, |
14 |
function () { |
15 |
return oSettings.aaSortingFixed == null; |
16 |
} |
17 |
); |
18 |
|
19 |
|
20 |
oTest.fnWaitTest( |
21 |
"Fixed sorting on first column (string/asc) with user sorting on second column (string/asc)", |
22 |
function () { |
23 |
oSession.fnRestore(); |
24 |
$('#example').dataTable( { |
25 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
26 |
"aaSortingFixed": [['0','asc']], |
27 |
"fnInitComplete": function () { |
28 |
$('#example thead th:eq(1)').click(); |
29 |
} |
30 |
} ); |
31 |
// |
32 |
}, |
33 |
function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; } |
34 |
); |
35 |
|
36 |
oTest.fnWaitTest( |
37 |
"Fixed sorting on first column (string/asc) with user sorting on second column (string/desc)", |
38 |
function () { |
39 |
$('#example thead th:eq(1)').click(); |
40 |
}, |
41 |
function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } |
42 |
); |
43 |
|
44 |
oTest.fnWaitTest( |
45 |
"Fixed sorting on fourth column (int/asc) with user sorting on second column (string/asc)", |
46 |
function () { |
47 |
oSession.fnRestore(); |
48 |
$('#example').dataTable( { |
49 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
50 |
"aaSortingFixed": [['3','asc']] |
51 |
} ); |
52 |
$('#example thead th:eq(1)').click(); |
53 |
}, |
54 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
55 |
); |
56 |
|
57 |
oTest.fnWaitTest( |
58 |
"Fixed sorting on fourth column (int/asc) with user sorting on second column (string/desc)", |
59 |
function () { |
60 |
$('#example thead th:eq(1)').click(); |
61 |
}, |
62 |
function () { return $('#example tbody td:eq(1)').html() == "PSP browser"; } |
63 |
); |
64 |
|
65 |
|
66 |
oTest.fnComplete(); |
67 |
} ); |