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