jqGrid:没有这样的方法:resetSelection

时间:2013-01-28 12:39:20

标签: asp.net-mvc-3 jqgrid lib.web.mvc

我正在为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 };
        }

0 个答案:

没有答案