Can you hide the Search box without disabling searching?

Can you hide the Search box without disabling searching?

SarcothSarcoth Posts: 3Questions: 1Answers: 0

Here is what I have and it is working:

$(document).ready(function() {
$('.mytable').dataTable( {
searching: true
} );
$('.mytable').DataTable().column( 7 ).search('SearchText').draw();
} );

Now, I would like to hide the global search box, but keep the default search I am performing. Is there a way to do that?

Answers

  • SarcothSarcoth Posts: 3Questions: 1Answers: 0

    As a workaround for this, I manually added "visibility: hidden" to the css file as follows:

    .dataTables_wrapper .dataTables_filter {
    float: right;
    text-align: right;
    visibility: hidden;
    }

    This hides the search box. I would have preferred a way to do it within the javascript, but this does the trick.

  • mRendermRender Posts: 151Questions: 26Answers: 13

    I think the search box is located in the dom and you just have to take out the letter that stands for the search box. I may be incorrect though.

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin

    Yes - the dom option is how to do it. Remove the f option (f for filter).

    Allan

  • SarcothSarcoth Posts: 3Questions: 1Answers: 0

    Modgility and allan, thank you for the reply. I used dom in the older version like that, but I wasn't sure that was the same way to do it now when using the newer commands. This works perfectly. Thanks again.

  • mRendermRender Posts: 151Questions: 26Answers: 13

    You're welcome. Sorry I couldn't remember what letter it was :)

This discussion has been closed.