Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table using Filter widget and filter-select drop-down does not work for columns with values containing quotes #1527

Closed
attitudemattrs opened this issue Mar 15, 2018 · 6 comments

Comments

@attitudemattrs
Copy link

attitudemattrs commented Mar 15, 2018

I am currently using v2.29.4 with the Filter widget. In this particular case the table in question has column data that contains quotes in it. For example: Aaron "Quote" Example. The data appears correctly within the table column and the filter's select drop-down, however, when you choose the quoted value from the drop-down, all rows are filtered out and no data is shown in the table. I have been able to construct a very simple example that demonstrates the problem. I have attached a zip file with this sample HTML file along with the JQuery and Table Sorter code being used.

Any help would be greatly appreciated.

TS-Filter-Example.zip

@Mottie
Copy link
Owner

Mottie commented Mar 15, 2018

Hi @attitudemattrs!

There is an issue with the filter select building code that doesn't handle quotes properly. I'll get it fixed ASAP, but it still won't work as expected because the filter widget uses quotes to exactly match the content.

Right now (without the fix), you can search the parsed content by setting the following three class names on the header (demo):

<th class="filter-select filter-match filter-parsed">...</th> 

This won't show the quotes in the select.

Once the fix is in place, you'll only need one class in the header:

<th class="filter-select">...</th> 

And you'll need to disable the "exact" filter matching for that column (make sure to set the desired column zero-based index):

$(function() {
  $("table").tablesorter({
    theme: "blue",
    widgets: ["zebra", "filter"],
    widgetOptions: {
      filter_excludeFilter: {
        2: "exact"
      }
    }
  });
});

@Mottie
Copy link
Owner

Mottie commented Mar 15, 2018

Oops, I guess the "right now" demo won't work if you use text instead of numbers... anyway, the fix is available in the master branch.

@attitudemattrs
Copy link
Author

Wow, thanks for the quick turn-around on the fix. I downloaded the master branch and tested the fix with my sample case and it worked like a champ, no changes required to add the filter_excludeFilter either, which is great.

I will work towards trying it out in the real code soon. Just to gauge timing on my end, do you know when the next versioned release is scheduled from the master? We are currently using the distribution version with the combined widgets file jquery.tablesorter.widgets.js and the .min.js files. I can adjust accordingly to incorporate your recent fix, but if the next release is due out soon I will wait for that.

BTW, thank you so much for all the work on this plugin. The plugin is excellent and very robust and flexible. The documentation (with examples) and responsive support is fantastic!

Again, I greatly appreciate the quick turn-around on this issue. Far beyond my expectations. Really.

@Mottie
Copy link
Owner

Mottie commented Mar 15, 2018

I need to find and spend some time fixing another bug, so hopefully, I'll get a new release out by tomorrow sometime.

@attitudemattrs
Copy link
Author

Thanks again! Greatly appreciated. You're awesome.

@Mottie
Copy link
Owner

Mottie commented Mar 18, 2018

V2.30.0 is now available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants