0
我正在使用MVC和Jquery数据表。 我只想传递我自己的参数作为类与jQuery数据表参数。 这里是我使用的代码,但它不工作,jquery datatable自定义对象参数
index.js
var options = {};
options.bProcessing = true;
options.bServerSide = true;
options.sAjaxSource = urlContent + 'Employee/GetAll';
options.bPaginate = true;
options.sPaginationType = "full_numbers";
options.iDisplayLength = 10;
options.bAutoWidth = true;
options.aoColumns = cols;
options.fnServerData = function (sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": function (data) { },
"failure": function (data) { }
});
};
options.fnServerParams = function (aoData) {
aoData.push({ "name": "employeeModel", "value": { Name : "testing", Age:25} });
};
var table = $('#' + tableId).DataTable(options);
沐控制器,
public JsonResult GetReportData(JQueryDataTableParamViewModel param, EmployeeViewModel employeeModel)
{
return new List<Employee>(); //// Loads from Database
}
的employeeModel
总是空。我在哪里做错了。请帮帮我。