Global Regex search needs to keyin backspace to work, How can it be resolved?

Global Regex search needs to keyin backspace to work, How can it be resolved?

c12caic12cai Posts: 1Questions: 1Answers: 0

Hello,

I've enabled reg exp for global search but it does not seem to be functioning properly.

As I type, the table begins to filter as expected, but when I enter the | operator to do an OR search, the table stops filtering. Only after pressing the backspace key does the filter begin working again.

I have created a codepen for the issue.
URL: https://codepen.io/anon/pen/WEPEoa

Scenario:
Action :In the search box type Dee|Vais
Expected output is 2 rows matching the Dee|Vais , but results show only row matching Dee unless backspace keyed in

Answers

  • kthorngrenkthorngren Posts: 20,269Questions: 26Answers: 4,765

    Interesting. Not sure why this does't seem to work:

        search: {
          regex: true,
          smart: false
        },
    

    However if you try the regex example and turn off smart search and on regex for the global search and type Tok|Lon it works as expected. This uses a search function instead of relying on the built in search. Will let #allan comment on why your search setting doesn't work as expected. Maybe you can use a function instead?

    Kevin

  • kthorngrenkthorngren Posts: 20,269Questions: 26Answers: 4,765

    One thing you may want to consider doing is using columns.render to change the filter to contain just the person's name. Your other data in the column may be affecting the search.

    More render info can be found here:
    https://datatables.net/manual/data/renderers

    Kevin

  • J33g73J33g73 Posts: 6Questions: 0Answers: 0

    I would like second that regex does not work with OR | until backspace is entered. This is with the recommended settings:
    search: {
    regex: true,
    smart: false
    },

  • jacksonjackson Posts: 4Questions: 3Answers: 0

    I'm facing the same problem. :/
    Is there still no solution or workaround?

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi all,

    Sorry, this one slipped through the net. I've also reproduced it here. I've raised it internally (DD-986 for my reference) and we'll report back here when there's an update.

    Cheers,

    Colin

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Fix committed in here for inclusion with v1.10.20.

    Allan

This discussion has been closed.