Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to customize bootstrap datatable search box and records view position

I have a problem when i was create datatable with bootstrap styling. i got datatable from this site (http://datatables.net/manual/styling/bootstrap)

i found less in accordance with the view that I have created. I make the navbar above table. so I want to make search box and view the records I put in navbar-right. as this is what I want.

before: enter image description here

i want to be like this

enter image description here

how to customize this? where the javascript code that must be changed or just enough customization with jquery?

like image 374
Sofyan Setiawan Avatar asked May 18 '14 16:05

Sofyan Setiawan


People also ask

How can we change width of search fields in DataTables?

ready(function () { $('. dataTables_filter input[type="search"]'). css( {'width':'350px','display':'inline-block'} ); }); And it worked perfectly!

How do I trigger a DataTable search?

So: var table = $('#myTable'). DataTable({ responsive: true, serverSide: true, ajax: { url: myUrl, dataSrc: '' }, fnServerData: function (sSource, aoData, fnCallback, oSettings) { oSettings. jqXHR = $.

What is bootstrap DataTable?

The Bootstrap DataTable is an advanced plugin to combine advanced data operation of the table. The Bootstrap4 DataTable is an advanced design and modify the version of the bootstrap table. The Bootstrap4 DataTable provides JavaScript validation and cascading style sheet design without any configuration.


Video Answer


1 Answers

http://datatables.net/examples/basic_init/dom.html

read carefull then come and read the rest of the comment here is an example:

when you understand write

     $('#example').dataTable({


      "dom":' <"search"f><"top"l>rt<"bottom"ip><"clear">'
    }


      );
});

this will make the search box has a class named "search" and leave everthing else as it is now you can easily edit the position of the search box using css if you want to do like the picture you posted just write

"dom":' <"search"fl><"top">rt<"bottom"ip><"clear">'
like image 79
Omran Avatar answered Sep 30 '22 18:09

Omran