| 1 |
// DATA_TEMPLATE: empty_table |
| 2 |
oTest.fnStart( "oLanguage.oPaginate" ); |
| 3 |
|
| 4 |
/* Note that the paging language information only has relevance in full numbers */ |
| 5 |
|
| 6 |
$(document).ready( function () { |
| 7 |
/* Check the default */ |
| 8 |
var oTable = $('#example').dataTable( { |
| 9 |
"sAjaxSource": "../../../examples/ajax/sources/objects.txt", |
| 10 |
"aoColumns": [ |
| 11 |
{ "mData": "engine" }, |
| 12 |
{ "mData": "browser" }, |
| 13 |
{ "mData": "platform" }, |
| 14 |
{ "mData": "version" }, |
| 15 |
{ "mData": "grade" } |
| 16 |
], |
| 17 |
"sPaginationType": "full_numbers" |
| 18 |
} ); |
| 19 |
var oSettings = oTable.fnSettings(); |
| 20 |
|
| 21 |
oTest.fnWaitTest( |
| 22 |
"oLanguage.oPaginate defaults", |
| 23 |
null, |
| 24 |
function () { |
| 25 |
var bReturn = |
| 26 |
oSettings.oLanguage.oPaginate.sFirst == "First" && |
| 27 |
oSettings.oLanguage.oPaginate.sPrevious == "Previous" && |
| 28 |
oSettings.oLanguage.oPaginate.sNext == "Next" && |
| 29 |
oSettings.oLanguage.oPaginate.sLast == "Last"; |
| 30 |
return bReturn; |
| 31 |
} |
| 32 |
); |
| 33 |
|
| 34 |
oTest.fnTest( |
| 35 |
"oLanguage.oPaginate defaults are in the DOM", |
| 36 |
null, |
| 37 |
function () { |
| 38 |
var bReturn = |
| 39 |
$('#example_paginate .first').html() == "First" && |
| 40 |
$('#example_paginate .previous').html() == "Previous" && |
| 41 |
$('#example_paginate .next').html() == "Next" && |
| 42 |
$('#example_paginate .last').html() == "Last"; |
| 43 |
return bReturn; |
| 44 |
} |
| 45 |
); |
| 46 |
|
| 47 |
|
| 48 |
oTest.fnWaitTest( |
| 49 |
"oLanguage.oPaginate can be defined", |
| 50 |
function () { |
| 51 |
oSession.fnRestore(); |
| 52 |
oTable = $('#example').dataTable( { |
| 53 |
"sAjaxSource": "../../../examples/ajax/sources/objects.txt", |
| 54 |
"aoColumnDefs": [ |
| 55 |
{ "mData": "engine", "aTargets": [0] }, |
| 56 |
{ "mData": "browser", "aTargets": [1] }, |
| 57 |
{ "mData": "platform", "aTargets": [2] }, |
| 58 |
{ "mData": "version", "aTargets": [3] }, |
| 59 |
{ "mData": "grade", "aTargets": [4] } |
| 60 |
], |
| 61 |
"sPaginationType": "full_numbers", |
| 62 |
"oLanguage": { |
| 63 |
"oPaginate": { |
| 64 |
"sFirst": "unit1", |
| 65 |
"sPrevious": "test2", |
| 66 |
"sNext": "unit3", |
| 67 |
"sLast": "test4" |
| 68 |
} |
| 69 |
} |
| 70 |
} ); |
| 71 |
oSettings = oTable.fnSettings(); |
| 72 |
}, |
| 73 |
function () { |
| 74 |
var bReturn = |
| 75 |
oSettings.oLanguage.oPaginate.sFirst == "unit1" && |
| 76 |
oSettings.oLanguage.oPaginate.sPrevious == "test2" && |
| 77 |
oSettings.oLanguage.oPaginate.sNext == "unit3" && |
| 78 |
oSettings.oLanguage.oPaginate.sLast == "test4"; |
| 79 |
return bReturn; |
| 80 |
} |
| 81 |
); |
| 82 |
|
| 83 |
oTest.fnTest( |
| 84 |
"oLanguage.oPaginate definitions are in the DOM", |
| 85 |
null, |
| 86 |
function () { |
| 87 |
var bReturn = |
| 88 |
$('#example_paginate .first').html() == "unit1" && |
| 89 |
$('#example_paginate .previous').html() == "test2" && |
| 90 |
$('#example_paginate .next').html() == "unit3" && |
| 91 |
$('#example_paginate .last').html() == "test4"; |
| 92 |
return bReturn; |
| 93 |
} |
| 94 |
); |
| 95 |
|
| 96 |
|
| 97 |
oTest.fnComplete(); |
| 98 |
} ); |