【问题标题】:Lib.Web.Mvc.JQuery.JqGrid Add/Edit buttons not appearingLib.Web.Mvc.JQuery.JqGrid 添加/编辑按钮未出现
【发布时间】:2013-11-03 03:40:57
【问题描述】:

我有来自 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 };

但是当页面呈现时,附加列对于列中的每一行都显示为“未定义”。

网上有人建议在几个地方确保response 具有我尝试过的response.Reader.RepeatItems = false;(但没有成功)。还有其他建议吗?

【问题讨论】:

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


    【解决方案1】:

    是的,所以这很愚蠢。

    如果您从 NuGet 获取,我需要包含 grid.locale-en.js,它通常位于 scripts/i18n 文件夹中。

    有关类似问题的更多详细信息,请参阅jqgrid undefined integer? pager not loading

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多