Lib.Web.Mvc.JQuery.JqGrid
除了添加添加/编辑按钮的功能外,我拥有来自 NuGet 的优秀库。我正在使用以下代码来初始化表:
@{
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;
尝试过(但它没有工作)。还有其他建议吗?