setting the pagelenght variable in datatable ?
setting the pagelenght variable in datatable ?
SBD999
Posts: 36Questions: 1Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
I use the datable below.
When I launch my application I only have one with 10 registrations although I should be seeing a significant number of pages
How to change the pageLenght in al datatable?
$(document).ready(function () {
$('#wSerieDatatable').dataTable({
"processing": true,
"serverSide": true,
"filter": true,
"ajax": {
"type": "POST",
"url": "/api/wSerie/doc",
"datatype": "data.json"
},
"columnDefs": [{
"targets": [0],
"visible": true,
"searchable": true
}],
"columnDefs": [{
"targets": [1],
"visible": true,
"searchable": true
}],
"columns": [
{ "data": "id", "name": "Id", "autoWidth": true },
{
"data": "path", "name": "path",'render': function (data, type, row, meta) {
return '<a href="/api/wSerie/?relativePath=' + row.path + '" >' + row.path + '</a>';
}
},
{
"data": "name", "name": "Name", 'render': function (data, type, row, meta) {
console.log(row);
return '<a href="/api/wSerie/doc/' + row.id + '" >' + row.name + '</a>';
}
},
{ "data": "created", "name": "Created", "autoWidth": true }
]
});
});
Replies
That suggests to me that
/api/wSerie/doc
does not implement server-side processing. Is that correct? If so, remove theserverSide
option from your initialisation options.Allan
Are you saying that the info element, ie
Showing 1 to 10 of 57 entries
, is showing only 10 entries but there should be more? Please provide more details of the problem.You have enabled server side processing which means the server script is responsible for calculating the total and filtered rows for the info element and paging buttons to display properly.
You can use the
pageLength
option to set the default page length. You can usepage.len()
API to programmatically change the page length.Kevin
Sorry, I did not specify that's i work in aspnet core
I made web api service as follow which is based on the jQuery DataTable object model.
and in api web I do
[HttpPost("doc")]
and after I do/api/wSerie/doc
All data is available in FilePath which is created in Sql View;
I tried to disable serverSide and return this message
So I think I have to enable serverSide. When is activate I see only ten records. My question is here?
@kthorngren
only 10 entries but there should be more?
Yes, that's right. I should see 2000 records so 20 pages, if I selected 10 in entries!
I see only 1 with 10records