这是我对行动方法的回应:
{
"draw": 1, "recordsTotal": 2, "recordsFiltered": 2, "data": [
{ "ISIN": "IMF284L016", "SubSchemeName": "Geliance jocused Marge Map Plan-Growth Option", "TotalAmountInvested": 400.0000, "CurrentValue": 507.402400, "Client": "23", "ClientName": "Lweta Kain " },
{ "ISIN": "IKF24K01o", "SubSchemeName": "", "TotalAmountInvested": 0.0000, "CurrentValue": 0.000000, "Client": "23", "ClientName": "Uweta Kain " }
]
}
以下是我的代码
$('#orderBookTable').DataTable({
"pageLength": 50,
"bProcessing": true,
"bServerSide": true,
"ajax": {
"url": "/Fund/Get",
"type": "POST",
"datatype": "Json",
"data": function (d) {
d.clientCode = $("#sltClientName").val();
},
"columns": [
{ "data": "SchemeName" },
{ "data": "Client" },
{ "data": "Invested" },
{ "data": "CurrentValue" },
{ "data": "CurrentValue" },
],
"fnCreatedRow": function (d) {
debugger;
}
}
});
请注意它。
我的服务器端代码使用Json方法返回JsonResult
答案 0 :(得分:0)
由于您的响应是复杂的JSON对象,并且根据可用的文档here,您应该更改列初始化,如下所示:
"columns": [
{ "data": "data.SchemeName" },
{ "data": "data.Client" },
{ "data": "data.Invested" },
{ "data": "data.CurrentValue" },
{ "data": "data.CurrentValue" },
],
希望它有所帮助!!