我正在尝试用数据填充jquery数据表。如果行数小于4000,则工作正常,但如果行数超过4000则不起作用。我尝试使用以下代码增加MaxJsonLength。
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
serializer.MaxJsonLength = Int32.MaxValue;
var jsonModel = serializer.Serialize(Model);
$(document).ready(function ()
{
try
{
var table = $('#MyPeople');
var TransactionData = '@Html.Raw(jsonModel)';
oTable = $(table).DataTable(
{
dom: '<"top">rt<"bottom"lip><"clear">',
fixedHeader: true,
scrollCollapse: true,
sScrollX: '100%',
stateSave: false,
ordering: true,
"sort": "true",
"initComplete": function (settings, json) {
setTimeout(function () {
$("#overlay").fadeOut("slow");
}, 30)
},
"processing": true, // for show progress bar
"language": { "processing": "processing... Pleae Wait" },
"serverSide": true, // for process server side
"ajax": {
"url": '@Url.Action("LoadTransactionData", "TravelAndEntertainment")',
"type": "POST",
"datatype": "json",
"data": { transactionData: TransactionData },
},
"columns": arrColumns,//column data
});
}
catch (err)
{
console.log("Error in operation! " + err);
}
});
当我尝试拨打&#39; @ Url.Action(&#34; LoadTransactionData&#34;,&#34; TravelAndEntertainment&#34;)&#39;并且提供类似&#34的错误时失败; DataTables警告:表id = tableID - Ajax错误。有关此错误的详细信息,请参阅http://datatables.net/tn/7&#34;
LoadTransactionData 我在控制器中编写的功能。我在哪里传递数据并进行分页和排序等。
如果有人遇到同样的问题,请告诉我,是否有解决此问题的方法?