Radislav Radislav - 2 months ago 17
jQuery Question

How to show all rows by default in JQuery DataTable

Does anybody know how to show all rows by default in jQuery datatable?

I have tried this code, but it only shows 10 rows by default.

$("#adminProducts").dataTable({
"aLengthMenu": [100]
});

Answer

Use:

$('#example').dataTable({
    aLengthMenu: [
        [25, 50, 100, 200, -1],
        [25, 50, 100, 200, "All"]
    ],
    iDisplayLength: -1
});

Or if using 1.10+

$('#example').dataTable({
    paging: false
});
Comments