1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aoSearchCols" );
4 /* We could be here forever testing this one, so we test a limited subset on a couple of colums */
6 $(document).ready( function () {
7 /* Check the default */
8 var oTable = $('#example').dataTable( {
9 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt"
11 var oSettings = oTable.fnSettings();
14 "Default should be to have a empty colums array",
18 oSettings.aoPreSearchCols[0].sSearch == 0 && !oSettings.aoPreSearchCols[0].bRegex &&
19 oSettings.aoPreSearchCols[1].sSearch == 0 && !oSettings.aoPreSearchCols[1].bRegex &&
20 oSettings.aoPreSearchCols[2].sSearch == 0 && !oSettings.aoPreSearchCols[2].bRegex &&
21 oSettings.aoPreSearchCols[3].sSearch == 0 && !oSettings.aoPreSearchCols[3].bRegex &&
22 oSettings.aoPreSearchCols[4].sSearch == 0 && !oSettings.aoPreSearchCols[4].bRegex;
29 "Search on a single column - no regex statement given",
32 oTable = $('#example').dataTable( {
33 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
36 { "sSearch": "Mozilla" },
43 function () { return $('#example_info').html() == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; }
47 "Search on two columns - no regex statement given",
50 oTable = $('#example').dataTable( {
51 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
54 { "sSearch": "Mozilla" },
61 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1.5"; }
65 "Search on single column - escape regex false",
68 oTable = $('#example').dataTable( {
69 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
71 { "sSearch": ".*ML", "bEscapeRegex": false },
79 function () { return $('#example_info').html() == "Showing 1 to 3 of 3 entries (filtered from 57 total entries)"; }
83 "Search on two columns - escape regex false on first, true on second",
86 oTable = $('#example').dataTable( {
87 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
89 { "sSearch": ".*ML", "bEscapeRegex": false },
90 { "sSearch": "3.3", "bEscapeRegex": true },
97 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Konqureror 3.3"; }
101 "Search on two columns (no records) - escape regex false on first, true on second",
103 oSession.fnRestore();
104 oTable = $('#example').dataTable( {
105 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
107 { "sSearch": ".*ML", "bEscapeRegex": false },
108 { "sSearch": "Allan", "bEscapeRegex": true },
115 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }