Ajax error when trying to return 10,000 records

Ajax error when trying to return 10,000 records

jfloanjfloan Posts: 2Questions: 1Answers: 1

Hi all,

I am pretty new to DataTables. I am currently receiving an error when trying to return 10,000 records. I can return 5,000 records and everything works perfectly.

Here is my code.
https://jsfiddle.net/7e1q3oqs/

I attached my C# code in my CSS portion, sorry for the confusion that may cause.

The exact error is:
DataTables warning: table id=tblCompanies - Ajax error. For more information about this error, please see http://datatables.net/tn/7

The LoadCompanies() method runs in 2.4 seconds, so I don't think it's poorly performing query. Any help would be very appreciated.

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    You need to follow the diagnostic steps described at http://datatables.net/tn/7

  • jfloanjfloan Posts: 2Questions: 1Answers: 1
    Answer ✓

    I was already at that page and it did nothing for me.

    I did answer my own question though. For anyone else that might search through this forum with a similar issue. I found that I had to resize my maxJsonLength of my jsonResult object before passing data back to the view.

    var ctx = dc.vwDivisionSearches.OrderBy(a => a.FullName).ToList();
    var jsonResult = Json(new { data = ctx }, JsonRequestBehavior.AllowGet);
    jsonResult.MaxJsonLength = int.MaxValue;
    return jsonResult;

  • allanallan Posts: 64,311Questions: 1Answers: 10,621 Site admin

    Thanks for posting back. Good to hear you've got it working.

    Allan

This discussion has been closed.