zaria khan zaria khan - 29 days ago 7
jQuery Question

pageLength in Datatable

I tried to set the pageLength of Datatable to 6 but it doesn't show 6 in count. See attached pictureenter image description here

$('#tblProviders').dataTable({
"autoWidth": false,
"searching": false,
"pageLength": 6,
"bDestroy": true,
data: data,
columns: [
{ "data": "ProviderName" },
{ "data": "ProviderQualificationTime" },
{ "data": "TotalServiceableOffers" }
]
});

Answer

Add lengthMenu to your code

"lengthMenu": [
         [6,10, 20, 50, 100, 150, -1],
         [6,10, 20, 50, 100, 150, "All"] // change per page values here
 ],