function initGrid() { localGrid = jQuery("#tbList"); localGrid.jqGrid({ data: localData, datatype: "local", gridview: true, height: 300, width: '90%', rowList: [5,10], colNames: innerColumns, autowidth: true, hoverrows: false, multiselect: false, colModel: [ { name: 'Id', index: 'Id', width: 100, hidden: true }, { name: 'Status', index: 'Status', width: 100 }, { name: 'GroupName', index: 'GroupName', width: 200 }, { name: 'LetterNumber', index: 'LetterNumber', width: 80, align: "center" }, { name: 'ApplyUnitName', index: 'ApplyUnitName', width: 80, align: "center" }, { name: 'StayDays', index: 'StayDays', width: 80, align: "center" }, { name: 'LeaderName', index: 'LeaderName', width: 80, align: "center" } ], emptyrecords: "没有任何数据", pager: "#pager", viewrecords: true, rownumbers: true, loadonce: true, grouping: true, rowNum:5, groupingView : { groupField: ['Status'] }, ondblClickRow: function (id) { //editInfo(id); }, caption: "团组信息" }).navGrid('#pager', { edit: false, add: false, del: false, searchtext: "搜索" }, {}, {}, {}, { search: true, sopt: ['cn', 'eq', 'ge', 'gt', 'le', 'lt'] }); }
加载时只显示5条数据, 就是通过 rowNum:5 这一属性实现的,当然此时你最好也将 rowList 的最少值设为 5 我这里是rowList :[5,10]