'Specify page size in jquery datatable server side pagination
I have a datatable which uses server side pagination with infinite scroll. So my pages loads as an when I scroll down the table. Now the default page size is 10. How can I override this number? I tried setting iDisplayLength:50, but didnt work.
ListDataTable= $("#ListDataPane_data").dataTable({
"iDisplayLength":50,
"bFilter": true,
"bServerSide": true,
"sServerMethod": "POST",
"sAjaxSource": ListResourcePaginationUrl,
"bProcessing": true,
"sPaginationType": "full_numbers",
"bJQueryUI": false,
"bDestroy": true,
"bScrollInfinite": true,
"sScrollY": "300px",
"sScrollX": "963px",
"fnServerParams": function (aaData) {
aaData.push(
{ "name": "Status", "value": status}
);
});
},
Please help.
Solution 1:[1]
It may be that the server doesn't respect the iDisplayLength value. In this case you must also update the server side.
Solution 2:[2]
"iDisplayLength":50 works, I just had to clear the browser cache.
Solution 3:[3]
you should call fnDraw method in DataTable after change iDisplayLength field value: table.fnSettings().iDisplayLength = 20; and table.fnDraw();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tea2code |
| Solution 2 | Seeker |
| Solution 3 | Alireza Alallah |
