1 |
// DATA_TEMPLATE: js_data |
2 |
oTest.fnStart( "aoColumns.bSeachable" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
/* Check the default */ |
6 |
var oTable = $('#example').dataTable( { |
7 |
"aaData": gaaData |
8 |
} ); |
9 |
var oSettings = oTable.fnSettings(); |
10 |
|
11 |
oTest.fnTest( |
12 |
"Columns are searchable by default", |
13 |
function () { oTable.fnFilter("Camino"); }, |
14 |
function () { return $('#example tbody tr:eq(0) td:eq(1)').html().match(/Camino/); } |
15 |
); |
16 |
|
17 |
oTest.fnTest( |
18 |
"Disabling sorting on a column removes it from the global filter", |
19 |
function () { |
20 |
oSession.fnRestore(); |
21 |
oTable = $('#example').dataTable( { |
22 |
"aaData": gaaData, |
23 |
"aoColumns": [ |
24 |
null, |
25 |
{ "bSearchable": false }, |
26 |
null, |
27 |
null, |
28 |
null |
29 |
] |
30 |
} ); |
31 |
oSettings = oTable.fnSettings(); |
32 |
oTable.fnFilter("Camino"); |
33 |
}, |
34 |
function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } |
35 |
); |
36 |
|
37 |
oTest.fnTest( |
38 |
"Disabled on one column has no effect on other columns", |
39 |
function () { oTable.fnFilter("Webkit"); }, |
40 |
function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } |
41 |
); |
42 |
|
43 |
oTest.fnTest( |
44 |
"Disable filtering on multiple columns", |
45 |
function () { |
46 |
oSession.fnRestore(); |
47 |
oTable = $('#example').dataTable( { |
48 |
"aaData": gaaData, |
49 |
"aoColumns": [ |
50 |
{ "bSearchable": false }, |
51 |
{ "bSearchable": false }, |
52 |
null, |
53 |
null, |
54 |
null |
55 |
] |
56 |
} ); |
57 |
oSettings = oTable.fnSettings(); |
58 |
oTable.fnFilter("Webkit"); |
59 |
}, |
60 |
function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } |
61 |
); |
62 |
|
63 |
oTest.fnTest( |
64 |
"Filter on second disabled column", |
65 |
function () { oTable.fnFilter("Camino"); }, |
66 |
function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } |
67 |
); |
68 |
|
69 |
|
70 |
oTest.fnComplete(); |
71 |
} ); |