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