简体   繁体   中英

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>

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

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

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

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 (ie show x entries ) you do that like this:

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

and here's the documentation for that .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM