1 // DATA_TEMPLATE: dom_data
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 var oSettings = oTable.fnSettings();
12 "Default should be to have a empty colums array",
16 oSettings.aoPreSearchCols[0].sSearch == 0 && !oSettings.aoPreSearchCols[0].bRegex &&
17 oSettings.aoPreSearchCols[1].sSearch == 0 && !oSettings.aoPreSearchCols[1].bRegex &&
18 oSettings.aoPreSearchCols[2].sSearch == 0 && !oSettings.aoPreSearchCols[2].bRegex &&
19 oSettings.aoPreSearchCols[3].sSearch == 0 && !oSettings.aoPreSearchCols[3].bRegex &&
20 oSettings.aoPreSearchCols[4].sSearch == 0 && !oSettings.aoPreSearchCols[4].bRegex;
27 "Search on a single column - no regex statement given",
30 oTable = $('#example').dataTable( {
33 { "sSearch": "Mozilla" },
40 function () { return $('#example_info').html() == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; }
44 "Search on two columns - no regex statement given",
47 oTable = $('#example').dataTable( {
50 { "sSearch": "Mozilla" },
57 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1.5"; }
61 "Search on single column - escape regex false",
64 oTable = $('#example').dataTable( {
66 { "sSearch": ".*ML", "bEscapeRegex": false },
74 function () { return $('#example_info').html() == "Showing 1 to 3 of 3 entries (filtered from 57 total entries)"; }
78 "Search on two columns - escape regex false on first, true on second",
81 oTable = $('#example').dataTable( {
83 { "sSearch": ".*ML", "bEscapeRegex": false },
84 { "sSearch": "3.3", "bEscapeRegex": true },
91 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Konqureror 3.3"; }
95 "Search on two columns (no records) - escape regex false on first, true on second",
98 oTable = $('#example').dataTable( {
100 { "sSearch": ".*ML", "bEscapeRegex": false },
101 { "sSearch": "Allan", "bEscapeRegex": true },
108 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }