fnFilter does not work correct?
fnFilter does not work correct?
Hello
strange behavior with filter function.
I try to make a filter "Not showing" (reverse filtering)
A table with column 4 (Status) and 8 rows from a database
Row 3 has the Word / value "Abschluss"
Row 5 has the Word / value "Betrieb"
Other rows has other values
for testing I did this:
$('#filter_rating').click(function() {
oProjectTable.fnFilter('[^Abschluss]$', 3, true, false);
});
The curios result is that row 3 is gone away (hidden) as expected but also row 5 with value "Betrieb"
Why this?
What is wrong with the Regex?
best regards
hawk
Replies
I'm not familiar with using regex with fnFilter, but try ^(Abschluss)$ instead of [^Abschluss]$
[ ] are explicit characters to match while ( ) contains a logical grouping of the expression.
You shouldn't even need the parenthesis -
^Abschluss$
will do withcolumn().search()
or the older fnFilter method.Allan
@allan
I had the fnFilter method as you can see in my post?
$('#filter_rating').click(function() { oProjectTable.fnFilter('[^Abschluss]$', 3, true, false); });
But the regex I am using was wrong.
hawk
Yup I saw it. As @ignignokt noted the regex was wrong, and as I noted you don't need the parenthesis in this particular case.
Allan