如何获取jqGrid中没有分页的所有数据

时间:2017-08-08 03:17:28

标签: asp.net-mvc jqgrid jqgrid-asp.net free-jqgrid

我使用jqGrid 4.6.0,ASP.Net MVC5,任何好东西。但是我有一个问题。 当我从页面中删除分页。我想加载jqGrid的所有数据而不分页。但是数据只在jqGrid页面中显示了20条记录。虽然从服务器36返回数据记录。

我的JQGrid:

var Pattern_Grid = $("#Pattern_Grid");
    Pattern_Grid.jqGrid({
        datatype: "json",
        height: 250,
        shrinkToFit: false,
        width: null,
        rownumbers: true,
        multiselect: true,
        pgbuttons: false,

        viewrecords: false,
        pgtext: "",
        pginput: false,
        //==========================================
        url: "/CusURL/GetBom",
        caption: "Patterns Linking",
        postData: {
            styleCode: styleCode, size: styleSize, serial: styleColorSerial, revNo: revNo
        },
        //mtype: 'POST',
        colModel: [
            {
                name: "MainItemCode", index: "MainItemCode",
                label: arrPatternCollName.MainItemCode,
                search: false, sort: false
            },
            {
                name: "ItemCode", index: "ItemCode",
                label: arrPatternCollName.ItemCode,
                search: false, sort: false
            },
            {
                name: "ItemName", index: "ItemName",
                label: arrPatternCollName.ItemName,
                search: false, sort: false
            },
            {
                name: "ItemColorWays", index: "ItemColorWays",
                label: arrPatternCollName.MainItemColorSerial
            },
            { name: "StyleColorSerial", index: "StyleColorSerial", hidden: false },
            { name: "UnitConSumTion", index: "UnitConSumTion", hidden: false },
            { name: "Consumpunit", index: "Consumpunit", hidden: false },
            { name: "Qty", index: "Qty", hidden: false },
            { name: "CurrCode", index: "CurrCode", hidden: false },
            { name: "RegistryDate", index: "RegistryDate", hidden: false },

            { name: "StyleCode", index: "StyleCode", hidden: true },
            { name: "StyleSize", index: "StyleSize", hidden: true },
            { name: "ItemColorSerial", index: "ItemColorSerial", hidden: true },
            { name: "RevNo", index: "RevNo", hidden: true },
            { name: "MainItemColorSerial", index: "MainItemColorSerial", hidden: true },
            { name: "PatternCode", index: "PatternCode", hidden: true }
    });  

我的数据返回超过36条记录数据只在jqGrid页面中显示20条记录:  url:" / CusURL / GetBom",

public JsonResult GetBom(string styleCode, string styleSize, string styleColorSerial, string revNo)
        {
            try
            {
                var bom = _bom.GetBom(styleCode, styleSize, styleColorSerial, revNo);
                return Json(bom.ToArray(), JsonRequestBehavior.AllowGet);
            }
            catch
            {
                return Json(new List<Bomt>().ToArray(), JsonRequestBehavior.AllowGet);
            }
        }

是否可以在没有分页的情况下显示jqGrid中的所有数据?

1 个答案:

答案 0 :(得分:1)

rowNum默认值设置为20

你可以设置rowNum = 10000或使用'jsonp'结果加载延迟加载的所有数据。