我正在为 jqGrid 使用强类型帮助器 - Lib.Web.Mvc
我不能强制 jqGrid 对我的数据进行排序。当我单击标题中的箭头时,我在 Firebug 中收到以下错误:
未捕获的异常:jqGrid - 没有这样的方法:resetSelection
当我点击行中的单元格时,我得到:
未捕获的异常:jqGrid - 没有这样的方法:setSelection
这是我的 js 代码:
@{
var grid = new Lib.Web.Mvc.JQuery.JqGrid.JqGridHelper<ViolationViewModel>("products",
dataType: Lib.Web.Mvc.JQuery.JqGrid.JqGridDataTypes.Json,
methodType: Lib.Web.Mvc.JQuery.JqGrid.JqGridMethodTypes.Post,
pager: true,
rowsNumber: 5,
sortingName: "Id",
sortingOrder: Lib.Web.Mvc.JQuery.JqGrid.JqGridSortingOrders.Asc,
url: Url.Action("Violation", "Cabinet"),
viewRecords: true,
rowsList: new List<int>() { 5, 10, 20, 30, 50, 100 },
autoWidth: true,
loadOnce: true,
rowsNumbers: true
);
}
我正在使用loadOnce
选项。
这段代码在行动:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Violation(JqGridRequest request)
{
JqGridResponse response = new JqGridResponse()
{
TotalRecordsCount = 7
};
response.Records.Add(new JqGridRecord<ViolationViewModel>("1", new ViolationViewModel
{
Id = 1,
Name = "Test1"
}));
response.Records.Add(new JqGridRecord<ViolationViewModel>("2", new ViolationViewModel
{
Id = 2,
Name = "Test2"
}));
response.Records.Add(new JqGridRecord<ViolationViewModel>("3", new ViolationViewModel
{
Id = 3,
Name = "Test3"
}));
response.Records.Add(new JqGridRecord<ViolationViewModel>("4", new ViolationViewModel
{
Id = 4,
Name = "Test4"
}));
response.Records.Add(new JqGridRecord<ViolationViewModel>("5", new ViolationViewModel
{
Id = 5,
Name = "Test5"
}));
response.Records.Add(new JqGridRecord<ViolationViewModel>("6", new ViolationViewModel
{
Id = 6,
Name = "Test6"
}));
response.Records.Add(new JqGridRecord<ViolationViewModel>("7", new ViolationViewModel
{
Id = 7,
Name = "Test7"
}));
return new JqGridJsonResult() { Data = response };
}