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]
打個廣告:如果你或你朋友需求微信投票點贊的可以給我留言