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