Mottie / tablesorter

Github fork of Christian Bach's tablesorter plugin + awesomeness ~

Home Page:https://mottie.github.io/tablesorter/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Select2 filter seems to be broken

robinbrisa opened this issue · comments

The select2 filter is broken. Selected values are not being filtered.
The bug is even there on the demo : https://mottie.github.io/tablesorter/docs/example-widget-filter-formatter-select2.html

Hi @robinbrisa!

Thanks for reporting this problem!

The issue seems to be if the selection contains 2 words instead of 1 ( See AlphaNumeric (exact; only available) in the demo), it filters but the selection does not show in the search box. In the first column, AlphaNumeric (match), choose "abc" and it shows in the select2 input, select "abc 1" in the second column and it is not displayed but the filter still works.

@Mottie Hello, we still have the same problem. Thanks for your help !

Hi @FlorianChretien!

Please elaborate on the issue you're having. A demo showing the problem would be appreciated.

As said above, if there is a space between words, nothing is displayed. We can also see it in the demo (2nd column) : https://mottie.github.io/tablesorter/docs/example-widget-filter-formatter-select2.html

Ahh, ok... I'll look into this on the weekend.

Thanks :D

commented

I commented in the Slack, but I'll put it here so other's can find it.

The issue resides on line 68 here https://github.com/Mottie/tablesorter/blob/master/js/widgets/widget-filter-formatter-select2.js.

If you remove the \s from the regex, the selected options with a space will work.
Additionally, some of the other special characters in the regex may cause issues depending on the data.

For example, I have a table that lists computer names, organizational units, and some other details about a computer. The computer names have a '-' in them, and OUs have a /, both were being picked up by the regex mentioned and prevented them from visually being selected. Hope this helps!

Thanks @sthkn!

Maybe adding an option for this regexp would be the best solution.

Sorry for the super-long delay! Version 2.31.2 is now available.