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