1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "iDisplayLength" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
/* Check the default */ |
6 |
$('#example').dataTable( { |
7 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt" |
8 |
} ); |
9 |
|
10 |
oTest.fnWaitTest( |
11 |
"Default length is ten", |
12 |
null, |
13 |
function () { return $('#example tbody tr').length == 10; } |
14 |
); |
15 |
|
16 |
oTest.fnWaitTest( |
17 |
"Select menu shows 10", |
18 |
null, |
19 |
function () { return $('#example_length select').val() == 10; } |
20 |
); |
21 |
|
22 |
|
23 |
oTest.fnWaitTest( |
24 |
"Set initial length to 25", |
25 |
function () { |
26 |
oSession.fnRestore(); |
27 |
$('#example').dataTable( { |
28 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
29 |
"iDisplayLength": 25 |
30 |
} ); |
31 |
}, |
32 |
function () { return $('#example tbody tr').length == 25; } |
33 |
); |
34 |
|
35 |
oTest.fnWaitTest( |
36 |
"Select menu shows 25", |
37 |
null, |
38 |
function () { return $('#example_length select').val() == 25; } |
39 |
); |
40 |
|
41 |
|
42 |
oTest.fnWaitTest( |
43 |
"Set initial length to 100", |
44 |
function () { |
45 |
oSession.fnRestore(); |
46 |
$('#example').dataTable( { |
47 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
48 |
"iDisplayLength": 100 |
49 |
} ); |
50 |
}, |
51 |
function () { return $('#example tbody tr').length == 57; } |
52 |
); |
53 |
|
54 |
oTest.fnWaitTest( |
55 |
"Select menu shows 25", |
56 |
null, |
57 |
function () { return $('#example_length select').val() == 100; } |
58 |
); |
59 |
|
60 |
|
61 |
oTest.fnWaitTest( |
62 |
"Set initial length to 23 (unknown select menu length)", |
63 |
function () { |
64 |
oSession.fnRestore(); |
65 |
$('#example').dataTable( { |
66 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
67 |
"iDisplayLength": 23 |
68 |
} ); |
69 |
}, |
70 |
function () { return $('#example tbody tr').length == 23; } |
71 |
); |
72 |
|
73 |
oTest.fnWaitTest( |
74 |
"Select menu shows 10 (since 23 is unknow)", |
75 |
null, |
76 |
function () { return $('#example_length select').val() == 10; } |
77 |
); |
78 |
|
79 |
|
80 |
oTest.fnComplete(); |
81 |
} ); |