Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove the search bar and footer added by the jQuery DataTables plugin?

People also ask

How do I remove search and show entries in dataTable?

To disable the "Show Entries" label, use "bInfo", example: "bFilter" is the search component, but are active by default. $(document). ready( function () { $('#example'). dataTable( { "bInfo": false } ); } );

What is Bfrtip dataTable?

The B is the Buttons extension and it tell DataTables where to put each element in the DOM that it creates.


For DataTables >=1.10, use:

$('table').dataTable({searching: false, paging: false, info: false});

If you still want to be able the .search() function of this plugin, you will need to "hide" the search bar html with the dom setting:

$('table').dataTable({dom: 'lrt'});

The defaults are lfrtip or <"H"lfr>t<"F"ip> (when jQueryUI is true), f char represents the filter (search) html in the dom, ip for the info and pagination (footer).

For DataTables <1.10, use:

$('table').dataTable({bFilter: false, bInfo: false});

or using pure CSS:

.dataTables_filter, .dataTables_info { display: none; }

Check out http://www.datatables.net/examples/basic_init/filter_only.html for a list of features to show/hide.

What you want is to set "bFilter" and "bInfo" to false;

$(document).ready(function() {
    $('#example').dataTable( {
        "bPaginate": false,
        "bFilter": false,
        "bInfo": false
                 } );
} );

You can also not draw the header or footer at all by setting sDom: http://datatables.net/usage/options#sDom

'sDom': 't' 

will display JUST the table, no headers or footers or anything.

It's discussed some here: http://www.datatables.net/forums/discussion/2722/how-to-hide-empty-header-and-footer/p1


If you are using custom filter, you might want to hide search box but still want to enable the filter function, so bFilter: false is not the way. Use dom: 'lrtp' instead, default is 'lfrtip'. Documentation: https://datatables.net/reference/option/dom


var table = $("#datatable").DataTable({
   "paging": false,
   "ordering": false,
   "searching": false
});

A quick and dirty way is to find out the class of the footer and hide it using jQuery or CSS:

$(".dataTables_info").hide();

if you are using themeroller:

.dataTables_wrapper .fg-toolbar { display: none; }