searchCols Regex Not Working as Expected
searchCols Regex Not Working as Expected
Hey guys, trying to use the searchCols definition to pre-filter a table the moment it loads. I'm sorting through a list of work orders, but I only want to show "In Progress", "In Queue", and others, but NOT "Completed".
This works fine as a straight search. It shows me "In Progress" items in column 6.
"searchCols": [
null,
null,
null,
null,
null,
{ "sSearch": "In Process", "escapeRegex": false},
null,
]
However, this doesn't do anything. It should just return everything in that column.:
"searchCols": [
null,
null,
null,
null,
null,
{ "sSearch": ".*", "escapeRegex": false},
null,
]
My goal is to use regex to find everything that isn't Completed, such as (^((?!Completed).)*$)
Any idea what I'm doing wrong here?
Replies
For point of reference. Here is the page for this example:
https://datatables.net/reference/option/searchCols
Figured it out... "escepeRegex": false appears to now be "regex": true
I think you need to enable regex (
{search: '^((?! Completed).)*$', regex: true}
). Something like this example:http://live.datatables.net/helegupe/1/edit
Kevin