jQuery DataTables Search on mouseclick

jQuery DataTables Search on mouseclick

SKRSKR Posts: 13Questions: 0Answers: 0
edited July 2012 in DataTables 1.9
Hi Allan,

I am working on jQuery Datatables. I have implemented predictive search functionality for the Search textbox such that as the user begins typing into it, a dropdown list of 10 most recent items/strings that were searched is displayed. Now the issue here is that if I select any of the list items using keyboard the filtering takes place instantly i.e. on every keypress whereas when I select a list item with a mouse-click it doesnt filter the table. I have to hit enter in order to filter the table. I want to be able to filter the table on keypress as well as mouseclick. How can this be implemented in datatables? Any suggestions would be of great help!

Replies

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin
    What event does the drop down fire when you select an item? It sounds like you might need to add an event handler for that and call fnFilter. Possibly an alternative would be to add a 'change' event handler which calls fnFilter on the input element (assuming change fires?).

    Allan
  • SKRSKR Posts: 13Questions: 0Answers: 0
    Hey Allan I added an event handler for the click event on the dropdown items and invoked fnFilter in the callback function. It worked as expected. Thanks a lot!!
This discussion has been closed.