Lib.Web.Mvc.JQuery.JqGrid添加/编辑按钮没有出现

时间:2013-11-03 03:40:58

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

我有来自NuGet的优秀库Lib.Web.Mvc.JQuery.JqGrid,除了添加添加/编辑按钮的功能。我使用以下代码初始化表:

@{
    var grid = new JqGridHelper<TVTViewModel>("tuples",
        dataType: JqGridDataTypes.Json,
        methodType: JqGridMethodTypes.Post,
        pager: true,
        rowsNumber: 50,
        sortingName: "RecordId",
        sortingOrder: JqGridSortingOrders.Asc,
        url: Url.Action("Details", new { nctId = Model.NctId }),
        viewRecords: true,
        cellEditingEnabled: true,
        cellEditingSubmitMode: JqGridCellEditingSubmitModes.ClientArray
        )
        .AddActionsColumn("Actions", width: 25,
inlineEditingOptions: new JqGridInlineNavigatorActionOptions { Keys = true },
editButton: false,
deleteOptions: new JqGridNavigatorDeleteActionOptions { Url = Url.Action("Test", "Test") });
}

以及以下控制器响应代码:

        JqGridResponse response = new JqGridResponse()
        {
            TotalPagesCount = (int)Math.Ceiling((float)totalRecordsCount / (float)request.RecordsCount),
            PageIndex = request.PageIndex,
            TotalRecordsCount = totalRecordsCount
        };

        int i = 0;

        foreach (TVTViewModel v in viewModels)
        {
            v.RecordId = i;
            response.Records.Add(new JqGridRecord<TVTViewModel>(v.RecordId.ToString(), v));
            i++;
        }

        return new JqGridJsonResult() { Data = response };

但是当页面呈现时,附加列只显示为&#34; undefined&#34;对于列中的每一行。

在线有人建议在几个地方确保response拥有我尝试过的response.Reader.RepeatItems = false;(并且它没有用)。还有其他建议吗?

1 个答案:

答案 0 :(得分:0)

是的,所以这是愚蠢的事情。

我需要添加grid.locale-en.js,如果你从NuGet获取它,通常会在scripts/i18n文件夹中。

有关类似问题的详情,请参阅jqgrid undefined integer? pager not loading