1 |
// DATA_TEMPLATE: html_table |
2 |
oTest.fnStart( "HTML auto detect" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
var oTable = $('#example').dataTable(); |
6 |
|
7 |
oTest.fnTest( |
8 |
"Initial sort", |
9 |
null, |
10 |
function () { |
11 |
var ret = |
12 |
$('#example tbody tr:eq(0) td:eq(0)').html() == '1' && |
13 |
$('#example tbody tr:eq(1) td:eq(0)').html() == '2' && |
14 |
$('#example tbody tr:eq(2) td:eq(0)').html() == '3'; |
15 |
return ret; |
16 |
} |
17 |
); |
18 |
|
19 |
oTest.fnTest( |
20 |
"HTML sort", |
21 |
function () { $('#example thead th:eq(1)').click() }, |
22 |
function () { |
23 |
var ret = |
24 |
$('#example tbody tr:eq(0) td:eq(0)').html() == '2' && |
25 |
$('#example tbody tr:eq(1) td:eq(0)').html() == '1' && |
26 |
$('#example tbody tr:eq(2) td:eq(0)').html() == '4'; |
27 |
return ret; |
28 |
} |
29 |
); |
30 |
|
31 |
oTest.fnTest( |
32 |
"HTML reverse sort", |
33 |
function () { $('#example thead th:eq(1)').click() }, |
34 |
function () { |
35 |
var ret = |
36 |
$('#example tbody tr:eq(0) td:eq(0)').html() == '3' && |
37 |
$('#example tbody tr:eq(1) td:eq(0)').html() == '4' && |
38 |
$('#example tbody tr:eq(2) td:eq(0)').html() == '1'; |
39 |
return ret; |
40 |
} |
41 |
); |
42 |
|
43 |
oTest.fnTest( |
44 |
"Numeric sort", |
45 |
function () { $('#example thead th:eq(0)').click() }, |
46 |
function () { |
47 |
var ret = |
48 |
$('#example tbody tr:eq(0) td:eq(0)').html() == '1' && |
49 |
$('#example tbody tr:eq(1) td:eq(0)').html() == '2' && |
50 |
$('#example tbody tr:eq(2) td:eq(0)').html() == '3'; |
51 |
return ret; |
52 |
} |
53 |
); |
54 |
|
55 |
|
56 |
oTest.fnComplete(); |
57 |
} ); |