1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "oSearch" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable( {
7 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
10 var oSettings = oTable.fnSettings();
13 "Default values should be blank",
16 var bReturn = oSettings.oPreviousSearch.sSearch == "" &&
17 !oSettings.oPreviousSearch.bRegex;
22 /* This test might be considered iffy since the full object isn't given, but it's reasonable to
23 * expect DataTables to cope with this. It should just assumine regex false
26 "Search term only in object",
29 oTable = $('#example').dataTable( {
30 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
37 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; }
41 "New search will kill old one",
43 oTable.fnFilter("Opera");
45 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Presto"; }
49 "Search plain text term and escape regex true",
52 $('#example').dataTable( {
53 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
61 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Nintendo DS browser"; }
65 "Search plain text term and escape regex false",
68 $('#example').dataTable( {
69 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
77 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Presto"; }
81 "Search regex text term and escape regex true",
84 $('#example').dataTable( {
85 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
93 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
97 "Search regex text term and escape regex false",
100 $('#example').dataTable( {
101 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
102 "bDeferRender": true,
109 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; }