1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "6872 - mDataProp and sDefaultContent for deep objects" );
4 $(document).ready( function () {
7 $.fn.dataTable.ext.sErrMode = "throw";
11 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
15 $('#example').dataTable( {
35 "Basic initialisation of objects works",
37 function () { return $('#example tbody td:eq(0)').html() === "a"; }
41 "Error when property missing (no default content)",
47 $('#example').dataTable( {
68 function () { return test; }
72 "Default content used for missing prop and no error",
76 $('#example').dataTable( {
88 { "mDataProp": "c", "sDefaultContent": "test" },
94 function () { return $('#example tbody td:eq(2)').html() === "test"; }
99 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
100 * Deep properties with a single object
104 "Basic test with deep properties",
106 oSession.fnRestore();
108 $('#example').dataTable( {
121 { "mDataProp": "z.a" },
122 { "mDataProp": "z.b" },
123 { "mDataProp": "z.c" },
124 { "mDataProp": "z.d" },
125 { "mDataProp": "z.e" }
129 function () { return $('#example tbody td:eq(0)').html() === "a"; }
133 "Error when property missing on deep get (no default content)",
135 oSession.fnRestore();
139 $('#example').dataTable( {
151 { "mDataProp": "z.a" },
152 { "mDataProp": "z.b" },
153 { "mDataProp": "z.c" },
154 { "mDataProp": "z.d" },
155 { "mDataProp": "z.e" }
162 function () { return test; }
166 "Default content used for missing prop on deep get and no error",
168 oSession.fnRestore();
170 $('#example').dataTable( {
182 { "mDataProp": "z.a" },
183 { "mDataProp": "z.b" },
184 { "mDataProp": "z.c" },
185 { "mDataProp": "z.d", "sDefaultContent": "test" },
186 { "mDataProp": "z.e" }
190 function () { return $('#example tbody td:eq(3)').html() === "test"; }
195 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
196 * Deep properties with individual objects
200 "Basic test with deep individual properties",
202 oSession.fnRestore();
204 $('#example').dataTable( {
215 { "mDataProp": "m.a" },
216 { "mDataProp": "n.b" },
217 { "mDataProp": "o.c" },
218 { "mDataProp": "p.d" },
219 { "mDataProp": "q.e" }
223 function () { return $('#example tbody td:eq(0)').html() === "a"; }
227 "Error when property missing on deep individual get (no default content)",
229 oSession.fnRestore();
233 $('#example').dataTable( {
243 { "mDataProp": "m.a" },
244 { "mDataProp": "n.b" },
245 { "mDataProp": "o.c" },
246 { "mDataProp": "p.d" },
247 { "mDataProp": "q.e" }
254 function () { return test; }
258 "Default content used for missing prop on deep individual get and no error",
260 oSession.fnRestore();
262 $('#example').dataTable( {
272 { "mDataProp": "m.a" },
273 { "mDataProp": "n.b" },
274 { "mDataProp": "o.c", "sDefaultContent": "test" },
275 { "mDataProp": "p.d" },
276 { "mDataProp": "q.e" }
280 function () { return $('#example tbody td:eq(2)').html() === "test"; }