Individual column searching (text inputs) results in multiple event listeners

Individual column searching (text inputs) results in multiple event listeners

bengustybengusty Posts: 1Questions: 1Answers: 0

I added the example code and HTML from https://datatables.net/examples/api/multi_filter to a page, and for some reason Chrome shows each input element has two instances of this keyup event listener bound to it. The end result seen when debugging is that the first time the event handler is called, the search is applied and columns are filtered as expected; the second time results in "no matching records found" being displayed. If I manually remove the extra instance of the event listener from a field then the search works correctly.

Any ideas on how the extra event handlers are added and how to address it?

Answers

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

    Hi @bengusty ,

    As you can see in the example you linked, they only have a single event handler, so this is something specific to your code. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.