Issues when processing over 1,400 rows - MVC - C#
Issues when processing over 1,400 rows - MVC - C#
ITP
Posts: 8Questions: 3Answers: 0
Ya'll-
I'm having an issue when my ajax call is returning over 1,400 rows. I get the error "DataTables warning: table id=SOCDTable - Ajax error. For more information about this error, please see http://datatables.net/tn/7" with a 500 - Internal Server Error. If I narrow my search to include less than 1,400 the datatable loads just fine. It's worth noting that the data looks just fine coming from the controller. Any ideas?
<div class="col-lg-9">
<table class="table table-sm" id="aTable">
<thead>
<tr>
<th>Type</th>
<th>NetworkName</th>
<th>ID</th>
<th>Serial</th>
<th>Model</th>
<th>Registration</th>
<th>Subscriber</th>
<th>Description</th>
<th>Status</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
$('#aTable').DataTable({
id: 'aTable',
responsive: true,
paging: true,
info: false,
ordering: false,
searching: false,
select: true,
columns: [
{ data: "Type" },
{ data: "NetworkName" },
{ data: "ID" },
{ data: "Serial" },
{ data: "Model" },
{ data: "Registration" },
{ data: "Subscriber" },
{ data: "Description" },
{ data: "Status" }],
ajax: {
url: "/pages/GetData",
type: "POST",
dataType: "json",
data: {
serial: serial,
subscriber: subscriber,
registration: registration,
networkName: networkName
},
autoWidth: true
}
});
This discussion has been closed.
Replies
That is an error processing on the server. The server logs should indicate why the server encountered an error.
Kevin
Kevin-
The reported error comes back as: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
It doesn't have any trouble with the serialization of less than 1400. Do you have any ideas on that?
You will need to refer to the documentation of the application/language that is doing the serialization to find out how to use the
maxJsonLength
value.Kevin
I found some documentation and I did update my JsonResult call return line to
return new JsonResult() { Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet, MaxJsonLength = Int32.MaxValue };
However, when I do that, DataTables returns:
jquery.dataTables.min.js:49 Uncaught TypeError: Cannot read property 'length' of undefined
From my understanding that error typically is due to the number of columns returning does not match the number of columns available in the table, but that is not my case. I'm sorry for all the questions, I've been banging my head on this one for a couple days on and off.
How does the JSON response compare with the previous config with less than 1400 rows? Does it do something like this thread? Seems there is something different that would cause the error.
Kevin