search filter text applied on a single column
search filter text applied on a single column
how can i change the way search box has so that instead of search in all columns, only searchs on a single column but still keeps the behaviour of search on every key press.
I know this can be done with fnFilter(text, column), but how can I invoke my function to use fnFilter every time a key is pressed on the search box?
I know this can be done with fnFilter(text, column), but how can I invoke my function to use fnFilter every time a key is pressed on the search box?
This discussion has been closed.
Replies
1. Make your own text box on the page and don't allow DataTables to draw it's own (i.e. use sDom)
2. Remove the event DataTables binds to the textbox it creates and then add your own event handler.
Either way you will need to call fnFilter on each keyup event for a textbox (i.e. $('#whatever input').keyup( function () { oTable.fnFilter( this.value, 1 ); } );
You can see an example of who number 2 might be achieved with this plug-in which binds it's own event handler to the tables input box: http://datatables.net/plug-ins#api_fnSetFilteringDelay
Allan