columns().search() and bFilter
columns().search() and bFilter
MartyF
Posts: 14Questions: 5Answers: 1
Hi all,
I am using the example code to filter each column separately :
// Setup - add a text input to each footer cell
$('#example tfoot th').each( function () {
var title = $('#example thead th').eq( $(this).index() ).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} );
My first column has been set to bFilter: false
. So I don't want to show the <input>
at the bottom of this column.
How can I do ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Try:
Allan
Thanks Allan, it works in this case. But how can I do if , for example, I have columns 3, 6 and 8 set to
bFilter: false
?Isn't there a way to look at the columns' options via JS ? I like my DT options to be centralized in one script, and my pages do not have the same columns.
What you could do is add a class to the searchable columns and use that class in the selector.
Unfortunately there isn't a public API to tell which columns are filterable at the moment. I'll be adding that in a future release.
Allan
Thank you for your reply !
Here is my modified code :
And the corresponding
columnDefs
: