1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "39 - nested null values" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
var test = false; |
6 |
|
7 |
$.fn.dataTable.ext.sErrMode = "throw"; |
8 |
|
9 |
oTest.fnTest( |
10 |
"No default content throws an error", |
11 |
function () { |
12 |
try { |
13 |
$('#example').dataTable( { |
14 |
"aaData": [ |
15 |
{ "a": "0", "b": {"c": 0} }, |
16 |
{ "a": "1", "b": {"c": 3} }, |
17 |
{ "a": "2", "b": null } |
18 |
], |
19 |
"aoColumns": [ |
20 |
{ "mDataProp": "a" }, |
21 |
{ "mDataProp": "b" }, |
22 |
{ "mDataProp": "b.c" } |
23 |
] |
24 |
} ); |
25 |
} |
26 |
catch(err) { |
27 |
test = true; |
28 |
} |
29 |
}, |
30 |
function () { return test; } |
31 |
); |
32 |
|
33 |
oTest.fnTest( |
34 |
"Table renders", |
35 |
function () { |
36 |
oSession.fnRestore(); |
37 |
|
38 |
$('#example').dataTable( { |
39 |
"aaData": [ |
40 |
{ "a": "0", "b": {"c": 0} }, |
41 |
{ "a": "1", "b": {"c": 3} }, |
42 |
{ "a": "2", "b": null } |
43 |
], |
44 |
"aoColumns": [ |
45 |
{ "mDataProp": "a" }, |
46 |
{ "mDataProp": "b" }, |
47 |
{ "mDataProp": "b.c", "sDefaultContent": "allan" } |
48 |
] |
49 |
} ); |
50 |
}, |
51 |
function () { return $('#example tbody td:eq(0)').html() === "0"; } |
52 |
); |
53 |
|
54 |
oTest.fnTest( |
55 |
"Default content applied", |
56 |
function () { |
57 |
oSession.fnRestore(); |
58 |
|
59 |
$('#example').dataTable( { |
60 |
"aaData": [ |
61 |
{ "a": "0", "b": {"c": 0} }, |
62 |
{ "a": "1", "b": {"c": 3} }, |
63 |
{ "a": "2", "b": null } |
64 |
], |
65 |
"aoColumns": [ |
66 |
{ "mDataProp": "a" }, |
67 |
{ "mDataProp": "b" }, |
68 |
{ "mDataProp": "b.c", "sDefaultContent": "allan" } |
69 |
] |
70 |
} ); |
71 |
}, |
72 |
function () { return $('#example tbody td:eq(8)').html() === "allan"; } |
73 |
); |
74 |
|
75 |
oTest.fnComplete(); |
76 |
} ); |