最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to remove the text "entries" on datatables - Stack Overflow

programmeradmin3浏览0评论

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>

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>
Share Improve this question edited Apr 17, 2015 at 9:15 radbyx asked Apr 17, 2015 at 7:39 radbyxradbyx 9,67022 gold badges90 silver badges133 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 10

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

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

demo -> http://jsfiddle/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 (i.e. show x entries) you do that like this:

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

and here's the documentation for that.

发布评论

评论列表(0)

  1. 暂无评论