您好我有以下代码
jQuery datatables插件(VIEW)
<script type="text/javascript">
$(document).ready(function () {
$('#table1').DataTable({
/* PROCESS NOTIFICATION */
"processing": true,
/* SERVER SIDE PROCESSING */
"serverSide": true,
"ajax":
{
"url": "GetNonstandardProgram",
"type": "POST"
},
"columnDefs":
[
/* HIDE ID COLUMN */
{
"targets": [ 0 ],
"visible": false,
"searchable": false
},
/* ACTION COLUMN */
{
"aTargets": [-1],
"mData": null,
"mRender": function (data, type, full) {
return '<a href="#" onclick="alert(\'' + full[0] + '\');">test</a>';
}
}
],
"bSort":false,
"bPaginate":true,
"iDisplayStart": 5,
"iDisplayLength": 2
});
});
我下载的参数类(MODEL)
/// <summary>
/// Class that encapsulates most common parameters sent by DataTables plugin
/// </summary>
public class jQueryDataTableParamModel
{
/// <summary>
/// Request sequence number sent by DataTable,
/// same value must be returned in response
/// </summary>
public string sEcho { get; set; }
/// <summary>
/// Text used for filtering
/// </summary>
public string sSearch { get; set; }
/// <summary>
/// Number of records that should be shown in table
/// </summary>
public int iDisplayLength { get; set; }
/// <summary>
/// First record that should be shown(used for paging)
/// </summary>
public int iDisplayStart { get; set; }
/// <summary>
/// Number of columns in table
/// </summary>
public int iColumns { get; set; }
/// <summary>
/// Number of columns that are used in sorting
/// </summary>
public int iSortingCols { get; set; }
/// <summary>
/// Comma separated list of column names
/// </summary>
public string sColumns { get; set; }
}
由jQuery(CONTROLLER)
触发的方法public JsonResult GetNonstandardProgram(SWIN.Models.jQueryDataTableParamModel param)
{
但是这一步是个问题。
所有值均为零或null。 所以问题是,为什么我没有看到任何参数值?!
数据表通过POST发送此参数
...
&start=5
&length=2
&search[value]=
...
&search[regex]=false
谢谢
答案 0 :(得分:0)
public class jQueryDataTableParamModel
{
到这个
/// <summary>
/// Number of records that should be shown in table
/// </summary>
public int length { get; set; }
//public int iDisplayLength { get; set; }
/// <summary>
/// First record that should be shown(used for paging)
/// </summary>
public int start { get; set; }
//public int iDisplayStart { get; set; }
并且刚刚使用了param.start和param.length