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