How do I set the size of the Search box?

How do I set the size of the Search box?

DagothDagoth Posts: 4Questions: 1Answers: 0

I apologize if this has been answered already but I can't seem to find anything related to setting the size of the search box, the default one is too small and i want the width to be bigger.

Answers

  • DagothDagoth Posts: 4Questions: 1Answers: 0

    That script you wrote doesn't work for me unfortunately.

  • rf1234rf1234 Posts: 2,949Questions: 87Answers: 416

    I am not going to write your code, sorry. Unless you are using Bootstrap 3 you will need to make modifications. You can use your browser's inspector and figure out what changes need to be made. If that doesn't work, post a test case as per the forum rules.

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923

    See if this answer helps:
    https://datatables.net/forums/discussion/comment/168011/#Comment_168011

    If not then minimally let us know the environment you have, ie, using standard Datatables styling, Bootstrap or other styling framework. Better yet build a simple example of what you have so we can provide a better answer.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • DagothDagoth Posts: 4Questions: 1Answers: 0

    I'm using the Bootstrap 4 styling for the datatable, I basically want it so that the search filter is on the left and length changer is on the right, I also want the search filter to be max width possible.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    You can use dom to move the elements around. If that doesn't resolve the issue, please post a test case as Kevin requested.

    Colin

  • DagothDagoth Posts: 4Questions: 1Answers: 0
    edited June 2020

    nvm, I got it, basically to put search filter on left and length selector on right, you've gotta add the dom options like this (if using bootstrap 4):

    "dom": "<'row'<'col-lg-10 col-md-10 col-xs-12'f><'col-lg-2 col-md-2 col-xs-12'l>>" +
               "<'row'<'col-sm-12'tr>>" +
               "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
    

    then place this in CSS:

            .dataTables_wrapper .dataTables_filter{
                float: left;
            }
            .dataTables_wrapper .dataTables_length{
                float: right;
            }
    

    to set width of filter use this:

        div.dataTables_wrapper div.dataTables_filter input {
              width: 100%; <!-- or whatever width you want -->
        }
    

    Hope this helps someone!

This discussion has been closed.