How to add a additional Searchfield
How to add a additional Searchfield
BetaOp
Posts: 1Questions: 1Answers: 0
I tried to add a Searchfield but it does not work properly
$(document).ready( function () {
var table =$('#dataTable').DataTable({
responsive: true,
"columns":
//XYZ
]
});
$('#column3_search').on( 'keyup', function () {
table
.columns( 3 )
.search( this.value )
.draw();
} );
} );
or
function filterColumn ( i ) {
$('#dataTable').DataTable().column( i ).search(
$('#col'+i+'_filter').val(),
$('#col'+i+'_regex').prop('checked'),
$('#col'+i+'_smart').prop('checked')
).draw();
}
$(document).ready( function () {
var table =$('#dataTable').DataTable({
responsive: true,
"columns": [
//XYZ
]
});
$('input.column_filter').on( 'keyup click', function () {
filterColumn( $(this).parents('tr').attr('data-column') );
} );
} );
i tired to make it like this
This discussion has been closed.
Answers
What exactly happens? Do you get errors in the browser's console?
Looks like your first option should work. Without seeing your complete solution it is hard to say what is wrong. Please post a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
I did create an example based on your fist code snippet which works:
http://live.datatables.net/ricawovo/2/edit
Kevin