Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the text "entries" on datatables

Datatables contains "Show [dropdown] entries", for choosing how many rows the table should display at a time.

I know how to remove "Show [dropdown] entries" all together by removing the l from this.

dom: '<"row"<"col-sm-6"l><"col-sm-6"f>>tp',

How do I remove the part "entries" of "Show [dropdown] entries"?

DOM added:

<div id="tableComputerPackages_length" class="dataTables_length">
    <label>
        Show
        <select class="form-control input-sm" name="tableComputerPackages_length" aria-controls="tableComputerPackages">
        entries
    </label>
</div>
like image 248
radbyx Avatar asked Apr 17 '15 07:04

radbyx


2 Answers

Simply change the language sLengthMenu setting from "Show _MENU_ entries" to

var table = $("#example").dataTable({
    language : {
        sLengthMenu: "Show _MENU_"
    }
}); 

demo -> http://jsfiddle.net/wj32k7ck/

like image 173
davidkonrad Avatar answered Sep 30 '22 20:09

davidkonrad


On Datatables 1.10 and up it's:

$('#example').dataTable( {
  "language": {
    "info": "Showing page _PAGE_ of _PAGES_"
  }
});

Here's the full documentation.

As a bonus, if you want to tweak the length menu wording (i.e. show x entries) you do that like this:

$('#example').dataTable( {
  "language": {
    "lengthMenu": "Display _MENU_ records"
  }
});

and here's the documentation for that.

like image 28
racl101 Avatar answered Sep 30 '22 21:09

racl101