Can we change the location of the default search box?

Can we change the location of the default search box?

SKCSKC Posts: 33Questions: 10Answers: 0
edited November 2016 in Free community support

By default the search box is positioned at the top-right corner of the DataTable.

I have 2 questions :

  1. is there a way to change it's default location?
  2. Can we disable or hide the search box?

Thank You.

Answers

  • allanallan Posts: 63,822Questions: 1Answers: 10,517 Site admin

    Yes to both - the dom option is the way for both of them. If you don't want the search box remove the f option from the string. If you want it else where, move it in the string. You may need to use some CSS as well to float it to the correct place.

    Allan

  • SKCSKC Posts: 33Questions: 10Answers: 0

    Thanks for the reply.

    So as per my understanding based on your comment I should write the code as follows :


    $('#example).DataTable( { responsive: true, dom: 'Bfrtip', //followed by remaining code });

    For CSS, can you provide a small sample code to show how to select the Button and move it some place else?

  • allanallan Posts: 63,822Questions: 1Answers: 10,517 Site admin

    It really depends what you want, but it might be as simple as:

    div.dt-buttons {
      float: right;
    }
    

    Allan

This discussion has been closed.