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]
});
Solution 1:
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
});
Solution 2:
The option you should use is iDisplayLength:
$('#adminProducts').dataTable({
'iDisplayLength': 100
});
Solution 3:
$('#table').DataTable({
"lengthMenu": [ [5, 10, 25, 50, -1], [5, 10, 25, 50, "All"] ]
});
Solution 4:
This one works for me:
$(document).ready(function() {
$('#example').DataTable( {
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
} );
} );