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

How to use filter-select when there are keywords like 'OR', 'AND' in table cells? #1505

Closed
thobho opened this issue Jan 30, 2018 · 3 comments

Comments

@thobho
Copy link

thobho commented Jan 30, 2018

Hi!
I have a problem with filter-select option. I have in table column values like 'temperature value or humidity'. I dropdown list with correct entries but when I choose this one with the word "OR" I get no correct filter. I tried to add class 'filter-exact' but it still does not work.

Best regards,
Thobho

@Mottie
Copy link
Owner

Mottie commented Jan 30, 2018

Hi @thobho!

The filter's default setting for "and", "or" and "to" can be modified by providing a language setting:

$.extend($.tablesorter.language, {
  to: "-",
  or: "\\|", // escape any special regexp characters, for now
  and: "&&"
});

The settings must not include surrounding spaces, and can not be an empty string.

In the next update, I'll catch the above problems to:

  • Remove surrounding spaces
  • Work around empty strings.
  • Automatically escape special regular expression characters.

Related: #1089 (comment) & #1101

Mottie added a commit that referenced this issue Jan 30, 2018
Automatic escaping of RegExp special characters must be done
manually as already explained in the documentation
@Mottie
Copy link
Owner

Mottie commented Jan 30, 2018

I ended up reverting the automatic escaping of special regular expression characters. It's already documented that it must be done and the change would not be backwards compatible; but the update will still trim surrounding spaces and allow empty strings to be set.

@Mottie Mottie removed the Next Update label Feb 2, 2018
@Mottie
Copy link
Owner

Mottie commented Feb 25, 2018

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.

@Mottie Mottie closed this as completed Feb 25, 2018
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