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.
To hide and show columns use columns() and visible() method. Call it on dataTables instance and pass column index in columns() method and false to visible() method. Similarly, pass true to visible() if you want to show the columns.
There is a option called pageLength . You can set this for show only 5 entries.
DataTables will read all of the information about the table from the page (the DOM) and add features such as filtering, paging and sorting. This follows the basis for progressive enhancement where a table will be enhanced if JavaScript is available, and not if the browser doesn't have the required capabilities.
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"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With