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