Individual column searching with search input in header second row
Individual column searching with search input in header second row
PatrickG42
Posts: 4Questions: 2Answers: 0
Hi,
I started from the example here:
http://datatables.net/examples/api/multi_filter.html
Then changed the selector for the position of the text inputs:
// Setup - add a text input to header cells with searchEntry class
$('#example .searchEntry').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} );
So far so good, the text inputs are where I want them.
Then changed the selector for the application of the search:
// Apply the search
table.columns().every( function () {
var that = this;
$( 'input', '.searchEntry' ).on( 'keyup change', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
Search does not find any row when entering text in the text inputs.
http://live.datatables.net/xaranuya/1/edit?js,output
What am I doing wrong?
This discussion has been closed.