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