Info show wrong data
Info show wrong data
etha0k
Posts: 8Questions: 1Answers: 0
I'm using datatable in MVC.
All work but info get wrong data showing "Showing 0 to 0 of 0 entries (filtered from NaN total entries)".
This my code:
$(document).ready(function () {
$('#datatableClienti').DataTable(
{
serverSide: "true",
processing: "true",
"stateSave": true,
"paging": true,
filter: true,
ajax: {
url: "/Cliente/ListaClienti",
type: "POST",
datatype: "json"
},
columns: [
{ data: "id", name: "id",visible: false },
{ data: "ragioneSociale", name: "ragioneSociale"},
{ data: "contatto", "name": "Contatto" },
{ data: "citta", "name": "Citta" },
{ data: "provincia", "name": "Provincia" },
{ data: "email", "name": "Email" }
],
"columnDefs": [ {
"targets": 1,
"render": function ( data, type, row, meta ) {
return '<a target="_blank" href="Cliente/Edit/' + row.id +'">' + data + '</a>';
}
}],
order:[0,"asc"],
lengthChange: true,
dom: '<"container-fluid"<"row"<"col"B><"col"l><"col"f>>>rtip',
//dom: '<"dt-buttons"Bf><"clear">lirtip',
buttons: [{
text: 'Nuovo',
className: 'text-info',
action: function ( e, dt, node, config ) {
location.href = "Cliente/Nuovo/";
}
},
'searchPanes','copy', 'csv', 'excel', 'pdf', 'print'],
keys: true
});
});
What's the problem?
Replies
I've found solution. Missing same parameter in the backend..
Note also that
serverSide: "true",
should not be a string. Per the docs (serverSide
) it should be a boolean. The same withprocessing
.Allan
I was wrong to answer in the wrong place. I haven't solved it yet
Happy to take a look at a test case showing the issue. My guess is that your server isn't sending back the data required since you are using server-side processing. Do you need it? Do you have tens of thousands of rows?
Allan
Yes there are more than 250,000 record in my table. But table work well. Why shows 0 of 0..?
Found solution. I missed return some parameter
Thanks for letting us know you've got it resolved.
Allan