VictorGram
VictorGram

Reputation: 2661

How create regex for "OR" condition <TableName>dataTable().fnFilter

Getting hard time to make a regex for "OR" condition work.

Example: table has 2 columns and trying to serach on 2nd column ( let's say - "status" column) and search regex is :

//javascript
$('#filter-status').change(function() {
     searchTxt =  "Not Shared|Private";
     <table name>.dataTable().fnFilter(searchTxt , 2,true);
}

Looks like it is pulling up data with "Not Shared" as status bu not pulling up data with "Private" status.

Even tried with searchTxt as "^(Not Shared)|(Private)$" and "/(^Not Shared$)|(^Private$)/ "

Not sure what I am missing. Can anyone help?

Upvotes: 4

Views: 5885

Answers (1)

VictorGram
VictorGram

Reputation: 2661

Found out it was not Regex issue. But Jquery dataTable().fnFilter smartsearch issue. I just had to make the 4th argument false and it worked.

<table name>.dataTable().fnFilter(searchTxt, 2, true, false);

Upvotes: 6

Related Questions