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