Rename “show XX entries” drop down in DataTables

2019-03-29 08:24发布

In DataTables is there any way to rename the Show ___ Entries drop down text? Specifically, I have a client who wants to change "Show" to "Display". If memory serves, this is generated by the lengthMenu item, but while I see how to customize the select box options I haven't found any way to change the label.

UPDATE: here is my relevant code.

$("#datatable").dataTable( {
  bFilter: false,
  "sDom": 'lfptip',
  "oLanguage": {
    "sLengthMenu": "Display _MENU_ records",
  }
  "aoColumnDefs": [{ "bSortable": false, "aTargets": [ 9 ] }, { sType: 'datetime-us-flex', aTargets: [0, 4] }, { sType: 'numeric-empty-bottom', aTargets: [7, 8] },
    { "sClass": "col-strong", "aTargets": [ 1 ] }
  ],
});

2条回答
劳资没心,怎么记你
2楼-- · 2019-03-29 08:44

You can use this

$('#example').dataTable( {
    "oLanguage": {
      "sLengthMenu": "Display _MENU_ records",
    }
});

from https://datatables.net/docs/DataTables/1.9.beta.1/DataTable.defaults.oLanguage.html#sLengthMenu_details

查看更多
啃猪蹄的小仙女
3楼-- · 2019-03-29 08:54
$('#example').dataTable( {
    "oLanguage": {
      "sLengthMenu": "Your words here _MENU_ and/or here",
    }
});

Demo | Docs

查看更多
登录 后发表回答