gpt4 book ai didi

jquery - jqgrid - 每页的项目

转载 作者:行者123 更新时间:2023-12-03 22:46:52 25 4
gpt4 key购买 nike

我无法为 jqgrid 配置每页的项目。我的 jqgrid 是:

        jQuery('#EmployeeTable').jqGrid({
url: '/Admin/IdeasJSON',
datatype: 'json',
postData: { page: page, pageIndex: pageIndex, Filter: Filter, DateStart: DateStart, DateEnd: DateEnd, TagID: TagID, StatusID: StatusID, CategoryID: CategoryID, IsDescription: IsDescription },
loadComplete: function () { pageIndex = null },
jsonReader: {
page: "page",
total: "total",
records: "records",
root: "rows",
repeatitems: false,
id: ""
},

...

MVC 方法返回:

        var result = new JsonResult()
{
Data = new { page = page, total = total, records = totalCount, rows = IdeaForJSONs }
};
result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;

return result;

其中 IdeaForJSONs 有 50 个元素。我不知道为什么,但网格显示 20 个元素。为什么?

最佳答案

看看 rowNum选项。来自文档:

Sets how many records we want to view in the grid. This parameter is passed to the url for use by the server routine retrieving the data. Note that if you set this parameter to 10 (i.e. retrieve 10 records) and your server return 15 then only 10 records will be loaded.

默认值为 20,这解释了为什么您只看到这么多行。

如果将其增加到 50,您应该会在网格中看到所有数据:

jQuery('#EmployeeTable').jqGrid({
url: '/Admin/IdeasJSON',
...
rowNum: 50,

关于jquery - jqgrid - 每页的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6377165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com