我建议你用标准的
datatype: 'json'
而不是
datatype
作为功能。你只需要额外使用
datatype: 'json',
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
mtype: 'GET',
Setting the content-type of requests performed by jQuery jqGrid
(例如)
public class jqGridTable
{
public int total { get; set; } // total number of pages
public int page { get; set; } // current zero based page number
public int records { get; set; } // total number of records
public List<jqGridRow> rows { get; set; }
}
public class jqGridRow
{
public string id { get; set; }
public List<string> cell { get; set; }
}
// jsonReader: { repeatitems : true, cell:"", id: "0" }
public class jqGridTable {
public int total { get; set; } // total number of pages
public int page { get; set; } // current zero based page number
public int records { get; set; } // total number of records
public List<List<string>> rows { get; set; }// first element of row must be id
}
也许你应该用点别的
jsonReader
d
web服务结果的属性(请参阅
Jqgrid 3.7 does not show rows in internet explorer
).
为了支持服务器端分页和排序,您应该添加
int page, int rows, string sidx, string sord
服务的参数列表。
更新
jqgrid Page 1 of x pager
拥有jqGrid和ASMX服务的完整代码。您可以使用以下简单的
JSON阅读器
:
jsonReader: { root: "d.rows", page: "d.page", total: "d.total",
records: "d.records", id: "d.names" }