kalyani14591 / jquery-datatables-column-filter

Automatically exported from code.google.com/p/jquery-datatables-column-filter
0 stars 0 forks source link

Special character and white spaces issue for exact search #65

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Get data with some special character or white space
2. Add select column filter
3. It won't match 

What is the expected output? What do you see instead?

The desire output should be to match exact string from datatable.
For example :- 
If the string is Mihir Soni or Mihir$Soni
It doesn't search 

What version of the product are you using? On what operating system?

The latest version

Original issue reported on code.google.com by mihirson...@gmail.com on 19 Apr 2012 at 8:24

GoogleCodeExporter commented 9 years ago
Hi,

I have managed to solve it and 

I have created following function

    function replaceSpecialCharacters(pattern) {
            var specials = new RegExp("[$+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\$
            //alert("Replacing " +pattern.replace(specials, "\\$&"));
            return pattern.replace(specials, "\\$&");
        }

and also made changes in Select function 

     oTable.fnFilter("^"+removeSpecialCharacters(unescape($(this).val().trim()))+"$", iColumn, bRegex); //Issue 41
                else
                    oTable.fnFilter(unescape($(this).val()), iColumn); //Issue 25
                fnOnFiltered();

Let me know if any more help is required

Original comment by mihirson...@gmail.com on 19 Apr 2012 at 10:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'm using version 1.5.6 of jquery.datatbales.columnfilter.js. This fix is not 
working for me. any thoughts ?? This specifically happens for column filter. 
However it works perfectly fine in global search filter box. Eg. I have the 
below data.

J & Josh 
J & J Associate 
J&J Associate 

In Global search if type J &(J space &), it brings all 3 records but in text 
column filter with bRegex true it brings two

In Global search if type J & J(J space & space J), it brings all 3 records but 
in text column filter with bRegex true it brings nothing (No matching records 
found) even though 2 records match. 

Please help.

Original comment by jquerydo...@gmail.com on 19 May 2014 at 3:49