Sol*_*nde 24 javascript jquery jquery-datatables
请问如何从我的Jquery数据表中隐藏LengthMenu(显示每页显示的记录数的下拉列表)?
目前我可以禁用它,但我不希望它出现.请看 下面的小提琴: -
testdata = [{"id":"58","country_code":"UK"},{"id":"59","country_code":"US"}];
$('#test').dataTable({
"aaData": testdata,
"aoColumns": [
{ "mDataProp": "id" },
{ "mDataProp": "country_code" }
],
"bLengthMenu" : false, //thought this line could hide the LengthMenu
"bInfo":false,
});
`//the next 2 lines disables the LengthMenu
//var aLengthMenu = $('select[name=test_length]');
//$(aLengthMenu).prop('display', 'disabled');
Run Code Online (Sandbox Code Playgroud)
Sri*_*r R 46
试试吧
$('#test').dataTable({
"aaData": testdata,
"aoColumns": [
{ "mDataProp": "id" },
{ "mDataProp": "country_code" },
{ "mDataProp": "title" },
{ "mDataProp": "pubdate" },
{ "mDataProp": "url" }
],
"bLengthChange" : false, //thought this line could hide the LengthMenu
"bInfo":false,
});
Run Code Online (Sandbox Code Playgroud)
Sha*_*tan 11
从 DataTables 1.10.18 开始,根据https://datatables.net/reference/option/lengthChange 这是隐藏 lengthMenu 的推荐方法:
$('#example').dataTable( { "lengthChange": false } );
Run Code Online (Sandbox Code Playgroud)
干杯
| 归档时间: |
|
| 查看次数: |
27794 次 |
| 最近记录: |