Is it possible to hide the Show Entries dropdown but keep the Search box in DataTable? I want to always display 10 rows with pagination at the bottom along with search box but do not want to display the Show entries dropdown.
14 Answers
You can find more information directly on this link: http://datatables.net/examples/basic_init/filter_only.html
$(document).ready(function() {
$('#example').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bInfo": false,
"bAutoWidth": false });
});
Hope that helps !
EDIT : If you are lazy, "bLengthChange": false, is the one you need to change :)
I solve it like that. Use bootstrap 4
$(document).ready(function () {
$('#table').DataTable({
"searching": false,
"paging": false,
"info": false
});
});
cdn js:
- https://code.jquery.com/jquery-3.3.1.min.js
- https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js
- https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js
- https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js
cdn css:
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
} );
} );
Enable or disable the table information display. This shows information about the data that is currently visible on the page, including information about filtered data if that action is being performed.
If you're using Angular you can use the following code to do the same.
in component.html
<table id="" datatable [dtOptions]="dtOptions" class="table dataTable">
and in your component.ts
dtOptions: any = {}
this.dtOptions = {
searching: true, //enables the search bar
info: false //disables the entry information
}
there more option for data table available please visit here to learn more