Easy individual column searching (multiple columns)
Easy individual column searching (multiple columns)
kmd1970
Posts: 36Questions: 8Answers: 1
For anyone looking for a quick solution to filter multiple columns outside of the Datatable structure.
This method simply uses generic form inputs (by class selector), passing in the filtered column index using data-* attributes.
http://jsfiddle.net/kmd1970/jz1zvvr1/
Also If you want to clear the input values when searching globally
$('.filter').on('keyup change', function () {
//clear global search value
dtable.search('');
dtable.column($(this).data('columnIndex')).search(this.value).draw();
});
$( ".dataTables_filter input" ).on( 'keyup change',function() {
//clear all column search values
dtable.columns().search('');
//clear all form input values
$('.filter').val('');
});
This discussion has been closed.
Replies
Nice one - thanks for sharing this with us!
Allan
Great!.
but if the search is performed via button click ? Searching all input text at once
How to make ? Thank´s
http://jsfiddle.net/kmd1970/yLxowxen/