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"
9 var oSettings = oTable.fnSettings();
12 "Default values should be blank",
15 var bReturn = oSettings.oPreviousSearch.sSearch == "" &&
16 !oSettings.oPreviousSearch.bRegex;
21 /* This test might be considered iffy since the full object isn't given, but it's reasonable to
22 * expect DataTables to cope with this. It should just assumine regex false
25 "Search term only in object",
28 oTable = $('#example').dataTable( {
29 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
35 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; }
39 "New search will kill old one",
41 oTable.fnFilter("Opera");
43 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Presto"; }
47 "Search plain text term and escape regex true",
50 $('#example').dataTable( {
51 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
58 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Nintendo DS browser"; }
62 "Search plain text term and escape regex false",
65 $('#example').dataTable( {
66 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
73 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Presto"; }
77 "Search regex text term and escape regex true",
80 $('#example').dataTable( {
81 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
88 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
92 "Search regex text term and escape regex false",
95 $('#example').dataTable( {
96 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
103 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; }