Disable Smart Filter and Enable Regex Filtering
Disable Smart Filter and Enable Regex Filtering
damaya1982
Posts: 12Questions: 0Answers: 0
Is there any way to make the search box in the header only do regex filtering? The example for regex filtering does not show how to do this. Basically, just make the search box that is already there globally filter on regex rather than smart for any search term that is entered.
This discussion has been closed.
Replies
Allan
The different ways I have done it are:
[code]
"oSearch": {"sSearch": "a", "bRegex":true, "bSmart": false},
"oSearch": {"bRegex":true, "bSmart": false},
"oSearch": {"bRegex":true},
[/code]
[code]
var table = $('#unit-view-table');
table.dataTable({
"oSearch": {"bSmart": false},
"sScrollY": "500px",
"sScrollX": "100%",
//"sScrollXInner": "150%",
//"sScrollYInner": "150%",
"bScrollCollapse": true,
"bStateSave": true,
"bSortClasses": false,
"bDeferRender": true,
"oColVis": {
//"buttonText": "Show / Hide columns",
"bRestore": true,
//"aiExclude": [ 18, 19 ]
// "sAlign": "left"
},
"iDisplayLength": 500,
"bPaginate": false,
"aLengthMenu": [[-1, 25, 50, 100], ["All", 25, 50, 100]],
"bProcessing": true,
//"bServerSide": true,
"sAjaxSource": "/cgi-bin/v_server.pl?action=output_json",
'aoColumns': [
/* 0 Host */
{
"mData": "host",
"bVisible": false,
"sDefaultContent": " "
},
/* 1 Location */
{
"mData": "loc_ser",
"sDefaultContent": " "
},
/* 2 Outcome */
{
"mData": "outcome",
"sDefaultContent": " "
},
/* 3 msg */
{
"mData": "notes",
"bSortable": false,
"sDefaultContent": " "
},
/* 4 Run Time */
{
"mData": "run_time",
"bVisible": false,
"sDefaultContent": " "
},
/* 5 Work Order */
{
"mData": "workorder",
"bVisible": false,
"sDefaultContent": " "
},
/* 6 Actions */
{
"mData": "menu",
"bSortable": false,
"sDefaultContent": " "
},
/* 7 Proceed */
{
"mData": "button",
"bSortable": false,
"sDefaultContent": " "
}
],
'sPaginationType': 'full_numbers',
"sDom": 'RC<"clear"><"dataTables_header"lfr>t<"dataTables_footer"ip>',
'fnInitComplete': function( oSettings )
{
// Style length select
table.closest('.dataTables_wrapper').find('.dataTables_length select').addClass('select blue-gradient glossy').styleSelect();
tableStyled = true;
}
}).fnSetFilteringDelay();
[/code]
If you type `Webkit|Presto` into the filter it does the expected OR.
Try disabling the filtering delay plug-in. I think that when fnFilter is called it is reseting the defaults in the instance to its own defaults (which is crap thing to do...).
Allan