1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "oSearch" );
4 /* Note with my server-side scripts the regex option has no effect - this just runs that down */
6 $(document).ready( function () {
7 /* Check the default */
8 var oTable = $('#example').dataTable( {
10 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php"
12 var oSettings = oTable.fnSettings();
15 "Default values should be blank",
18 var bReturn = oSettings.oPreviousSearch.sSearch == "" &&
19 !oSettings.oPreviousSearch.bRegex;
24 /* This test might be considered iffy since the full object isn't given, but it's reasonable to
25 * expect DataTables to cope with this. It should just assumine regex false
28 "Search term only in object",
31 oTable = $('#example').dataTable( {
33 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
39 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1"; }
43 "New search will kill old one",
45 oTable.fnFilter("Opera");
47 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Opera 7.0"; }
51 "Search plain text term and escape regex true",
54 $('#example').dataTable( {
56 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
63 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Nintendo DS browser"; }
67 "Search plain text term and escape regex false",
70 $('#example').dataTable( {
72 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
79 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Opera 7.0"; }
83 "Search regex text term and escape regex true",
86 $('#example').dataTable( {
88 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
95 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }