Enhancing the Global Search

Enhancing the Global Search

bharbhar Posts: 18Questions: 6Answers: 0
edited September 2015 in DataTables 1.10

I am trying to get Global Search redraw the table on Enter keypress and not on Any keypress. This is the code I am using.

initComplete: function ( settings, json ) {

          ('#example4_filter input').unbind();

            $('#example4_filter input').bind('keyup', function(e) {

                if(e.keyCode == 13) {

                     dt4.search( this.value ).draw();

                }

            }); 
    }

'''
Somehow it does not seem to work, any suggestions...?

Answers

  • allanallan Posts: 63,696Questions: 1Answers: 10,500 Site admin

    You need to unbind keypress and the other events that DataTables listens for. You'll find those events in the source file core.filter.js.

    Allan

  • bharbhar Posts: 18Questions: 6Answers: 0

    I use 1.10 version. I do not find the file : core.filter.js in my installation. Anyone here willing to help...

  • bharbhar Posts: 18Questions: 6Answers: 0

    Someone on stackoverflow has posted that the above code works. Not working when I try it.....can someone rectify the above code?

  • allanallan Posts: 63,696Questions: 1Answers: 10,500 Site admin
    edited September 2015

    The file I mentioned is in the source repo here.

  • bharbhar Posts: 18Questions: 6Answers: 0

    Seems to be getting more complicated ...rather than easier.....

    Someone can take a min or two to just guide on how to go about it...

This discussion has been closed.