Change values of select box of “show 10 entries” o

2019-01-21 09:00发布

By default, jquery datatable shows 10 by default and has

options : 10,25,50,100

How can I change these options?

8条回答
Animai°情兽
2楼-- · 2019-01-21 09:34

According to datatables.net the proper way to do this is adding the lengthMenu property with an array of values.

$(document).ready(function() {
    $('#example').dataTable( {
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
    } );
} );
查看更多
smile是对你的礼貌
3楼-- · 2019-01-21 09:39

If you want to use 'lengthMenu' together with buttons(copy, export), you have to use this option dom: 'lBfrtip'. Here https://datatables.net/reference/option/dom you can find meaning of each symbol. For example, if you will use like this 'Bfrtip', lengthMenu will not appears.

查看更多
登录 后发表回答