我想知道如何在 asp.net mvc 4 应用程序中将数据传递给 datatable.net。
像这个例子: http ://www.datatables.net/release-datatables/examples/data_sources/ajax.html
我想要的输出格式是这样的,但我不知道如何产生这个结果:
{
"aaData": [
[
"Trident",
"Internet Explorer 4.0",
"Win 95+",
"4",
"X"
],
[
"Trident",
"Internet Explorer 5.0",
"Win 95+",
"5",
"C"
]
]
}
到目前为止,我有这样的事情:
public JsonResult GetDataList(int? assetId)
{
var tableData = DBData.ToList();
var res = new JsonResult
{
JsonRequestBehavior = JsonRequestBehavior.AllowGet,
Data = ??? // I must do something here with tableData
};
return res;
}