Change values of select box of “show 10 entries” of jquery datatable

后端 未结 9 1410
攒了一身酷
攒了一身酷 2021-01-30 12:24

By default, jquery datatable shows 10 by default and has

options : 10,25,50,100

How can I change these options?

9条回答
  •  遇见更好的自我
    2021-01-30 13:10

    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"]]
        } );
    } );
    

提交回复
热议问题