6

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.

0

2 Answers 2

17

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"
 }
Sign up to request clarification or add additional context in comments.

1 Comment

That's what I was looking for: oLanguage: { sLengthMenu: "_MENU_", }. Thanks!
4

Use this code to remove Data Table showing entries

    $('#myDataTable').dataTable({
       "bInfo" : false
    });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.