Reputation: 3083
I have looked at several other responses and tried them all but nothing works. I have the following in my table:
Date Severity
2016-04-24 Not Critical
2016-04-24 Critical [what I need returned]
2017-01-09 Not Critical
2017-09-13 Critical
I am trying to search for all rows where severity is Critical (value) for 2016 (year). So far I have:
table.search( year + " " + value ).draw();
This returns both rows for 2016. How can I get it to return just the row that I need?
Upvotes: 0
Views: 1540
Reputation: 58880
You may need to enable and use regular expressions with search()
and column().search()
API methods.
Since you need to search two columns simultaneously, it may be better to combine two calls to column().search()
.
For example:
table
.column(0).search('2016')
.column(1).search('^Critical$', true, false)
.draw();
where 0
and 1
are indexes of your date and severity columns.
See this example for code and demonstration.
Upvotes: 3