1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "oLanguage.sZeroRecords" ); |
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 |
"Zero records language is 'No matching records found' by default", |
20 |
null, |
21 |
function () { return oSettings.oLanguage.sZeroRecords == "No matching records found"; } |
22 |
); |
23 |
|
24 |
oTest.fnWaitTest( |
25 |
"Text is shown when empty table (after filtering)", |
26 |
function () { oTable.fnFilter('nothinghere'); }, |
27 |
function () { return $('#example tbody tr td')[0].innerHTML == "No matching records found" } |
28 |
); |
29 |
|
30 |
|
31 |
|
32 |
oTest.fnWaitTest( |
33 |
"Zero records language can be defined", |
34 |
function () { |
35 |
oSession.fnRestore(); |
36 |
oTable = $('#example').dataTable( { |
37 |
"sAjaxSource": "../../../examples/ajax/sources/objects.txt", |
38 |
"aoColumnDefs": [ |
39 |
{ "mData": "engine", "aTargets": [0] }, |
40 |
{ "mData": "browser", "aTargets": [1] }, |
41 |
{ "mData": "platform", "aTargets": [2] }, |
42 |
{ "mData": "version", "aTargets": [3] }, |
43 |
{ "mData": "grade", "aTargets": [4] } |
44 |
], |
45 |
"oLanguage": { |
46 |
"sZeroRecords": "unit test" |
47 |
} |
48 |
} ); |
49 |
oSettings = oTable.fnSettings(); |
50 |
}, |
51 |
function () { return oSettings.oLanguage.sZeroRecords == "unit test"; } |
52 |
); |
53 |
|
54 |
oTest.fnWaitTest( |
55 |
"Text is shown when empty table (after filtering)", |
56 |
function () { oTable.fnFilter('nothinghere2'); }, |
57 |
function () { return $('#example tbody tr td')[0].innerHTML == "unit test" } |
58 |
); |
59 |
|
60 |
|
61 |
oTest.fnComplete(); |
62 |
} ); |