[6286] | 1 | // DATA_TEMPLATE: empty_table |
---|
| 2 | oTest.fnStart( "aoSearchCols" ); |
---|
| 3 | |
---|
| 4 | /* We could be here forever testing this one, so we test a limited subset on a couple of colums */ |
---|
| 5 | |
---|
| 6 | $(document).ready( function () { |
---|
| 7 | /* Check the default */ |
---|
| 8 | var oTable = $('#example').dataTable( { |
---|
| 9 | "bServerSide": true, |
---|
| 10 | "sAjaxSource": "../../../examples/examples_support/server_processing_filter_col.php" |
---|
| 11 | } ); |
---|
| 12 | var oSettings = oTable.fnSettings(); |
---|
| 13 | |
---|
| 14 | oTest.fnWaitTest( |
---|
| 15 | "Default should be to have a empty colums array", |
---|
| 16 | null, |
---|
| 17 | function () { |
---|
| 18 | var bReturn = |
---|
| 19 | oSettings.aoPreSearchCols[0].sSearch == 0 && !oSettings.aoPreSearchCols[0].bRegex && |
---|
| 20 | oSettings.aoPreSearchCols[1].sSearch == 0 && !oSettings.aoPreSearchCols[1].bRegex && |
---|
| 21 | oSettings.aoPreSearchCols[2].sSearch == 0 && !oSettings.aoPreSearchCols[2].bRegex && |
---|
| 22 | oSettings.aoPreSearchCols[3].sSearch == 0 && !oSettings.aoPreSearchCols[3].bRegex && |
---|
| 23 | oSettings.aoPreSearchCols[4].sSearch == 0 && !oSettings.aoPreSearchCols[4].bRegex; |
---|
| 24 | return bReturn; |
---|
| 25 | } |
---|
| 26 | ); |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | oTest.fnWaitTest( |
---|
| 30 | "Search on a single column - no regex statement given", |
---|
| 31 | function () { |
---|
| 32 | oSession.fnRestore(); |
---|
| 33 | oTable = $('#example').dataTable( { |
---|
| 34 | "bServerSide": true, |
---|
| 35 | "sAjaxSource": "../../../examples/examples_support/server_processing_filter_col.php", |
---|
| 36 | "aoSearchCols": [ |
---|
| 37 | null, |
---|
| 38 | { "sSearch": "Mozilla" }, |
---|
| 39 | null, |
---|
| 40 | { "sSearch": "1" }, |
---|
| 41 | null |
---|
| 42 | ] |
---|
| 43 | } ); |
---|
| 44 | }, |
---|
| 45 | function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1"; } |
---|
| 46 | ); |
---|
| 47 | |
---|
| 48 | oTest.fnWaitTest( |
---|
| 49 | "Search on two columns - no regex statement given", |
---|
| 50 | function () { |
---|
| 51 | oSession.fnRestore(); |
---|
| 52 | oTable = $('#example').dataTable( { |
---|
| 53 | "bServerSide": true, |
---|
| 54 | "sAjaxSource": "../../../examples/examples_support/server_processing_filter_col.php", |
---|
| 55 | "aoSearchCols": [ |
---|
| 56 | null, |
---|
| 57 | { "sSearch": "Mozilla" }, |
---|
| 58 | null, |
---|
| 59 | { "sSearch": "1.5" }, |
---|
| 60 | null |
---|
| 61 | ] |
---|
| 62 | } ); |
---|
| 63 | }, |
---|
| 64 | function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1.5"; } |
---|
| 65 | ); |
---|
| 66 | |
---|
| 67 | /* No regex escape searches here - would need to be implemented on the server-side */ |
---|
| 68 | |
---|
| 69 | oTest.fnComplete(); |
---|
| 70 | } ); |
---|