fnFilter does not work if one column is empty (bug or feature? )
fnFilter does not work if one column is empty (bug or feature? )
hawkmaster
Posts: 56Questions: 20Answers: 0
Hello
I have implemented a Filter function with fnFilter and Regex to hide DataTable rows which are in the filter.
It works fine but I have seen a strange behavior if a row has a column which is empty.
myTable.fnFilter('^(?!(?:' + selectedRatingRegexValues + ')$).+$', 5, true, false);
This Filter should work for the 6. column. But if the coulmn 5 is empty the filter does not work for column 6 in this row.
Is there a workaround for that behavior?
regards
hawk
This discussion has been closed.
Answers
no ideas?
Is this a normal behavior with an empty column?
Hello,
I do not know if this is the best or correct solution.
I made a render function for columns which can be empty with HTML
So the columns seems to be still empty but the fnFilter function works now also for this columns
"render": function ( data, type, row ) {
if(data){
return data;
}
else{
return ' ';
}
I mean HTML -& n b s p ;-
(nonbreaking space)
Sounds like you might be using an old version of DataTables. There was a release or two which had this bug (can't remember which exactly, was around 1.10.1/2 I think). Try the latest release and see if that helps.
Allan
Allen, thanks a lot for this hint.
This was the trick. I had version 1.10.1. Now with the newest version it runs also without the render function.