Reputation: 89
jQuery dataTables hide "Show Entries" text but show the dropdown list in right side of page.
$('#myTable_reports_view').DataTable({
"aoColumnDefs": [
{"bSortable": false, "aTargets": [2,3,4,5,7]}
],
"bFilter": false,
"bInfo": false,
"bLengthChange": true
});
I am adding this code. The problem is "Show DDL entries" is getting hide but I want to hide the text part only, not the dropdown list.
Upvotes: 6
Views: 13577
Reputation: 144
Use this code to remove Data Table showing entries
$('#myDataTable').dataTable({
"bInfo" : false
});
Upvotes: 4
Reputation: 85538
Yes, hiding the lengthmenu hides the text and the lengthmenu. If you just want to get rid of the "Show XX entries" text, then simply alter the language settings for that particular element. The default settings is :
"oLanguage": {
"sLengthMenu": "Show _MENU_ entries"
}
reset that in your initialization :
$('#myTable_reports_view').DataTable({
"bFilter": false,
"bInfo": false,
"bLengthChange": true,
oLanguage: {
sLengthMenu: "_MENU_",
}
});
Now you will only have the dropdown, not the prefix / suffixes. Here is an extracted list of all oLanguage
defaults :
"oLanguage": {
"oAria": {
"sSortAscending": ": activate to sort column ascending",
"sSortDescending": ": activate to sort column descending"
},
"oPaginate": {
"sFirst": "First",
"sLast": "Last",
"sNext": "Next",
"sPrevious": "Previous"
},
"sEmptyTable": "No data available in table",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sDecimal": "",
"sThousands": ",",
"sLengthMenu": "Show _MENU_ entries",
"sLoadingRecords": "Loading...",
"sProcessing": "Processing...",
"sSearch": "Search:",
"sSearchPlaceholder": "",
"sUrl": "",
"sZeroRecords": "No matching records found"
}
Upvotes: 17