我有大约 50 条记录,我只想在 jqgrid 中每页显示 10 行。如果我设置 rowNum:10,它只显示 10 条记录,loadOnce:true。我希望实现客户端列搜索,所以我使用了 loadonce 属性。我知道使用 loadonce:true 只会获取 rowNum 属性中指定的数量记录。
谢谢。
$("#grid").jqGrid({
url:"<%=url%>ObjectController?module="+module+"&levelId="+levelId+"&subLevelId="+subLevelId+"&subSubLevelId="+subSubLevelId+"&docRefNo="+docRefNo+"&divisionId="+divisionId+"&deptId="+deptId+"&viewDocStatus="+viewDocStatus+"&docStatus="+docStatus+"&queryString="+queryString+"&qString="+qString+"&V="+plantId+"&searchString="+searchString,
datatype: "json",
rowNum:10,
rowList : PAGINATIONPAGESIZES,
paging: true,
autowidth: true,
altRows:false,
rownumbers: true,
multiselect: true,
shrinkToFit: false,
viewrecords: true,
loadonce:true,
ignoreCase:true,
multiboxonly: false,
loadComplete : function () {
jQuery("#grid").setGridParam({rowNum:10}).trigger("reloadGrid");
},
beforeSelectRow: handleMultiSelect,
<% if(workFlowCreatorRoleList != null
&& workFlowCreatorRoleList.size() >0
&& workFlowCreatorRoleList.contains(Integer.valueOf(roleId))
|| (session.getAttribute("employeeRoleId")!=null
&& session.getAttribute("employeeRoleId").toString().equalsIgnoreCase(com.sobis.ims.util.ApplicationConstants.GLOBAL_ADMIN_ROLE))) { %>
colNames: ["","docId","","I","","","R","Document No","Title","Issue No","Rev No","Issue Effective Date","","","",""],
<% } else { %>
colNames: ["","docId","","Document No","Title","Issue No","Rev No","Issue Effective Date","","","",""],
<% } %>
colModel: [{
name: 'viewURL',
search:true,
hidden:true,
width:0,
fontsize:'5px',
resizable: true,
title :false,
classes:"grid-col",
},{
最佳答案
rowNum参数显示指定的记录数,而loadonce则加载所有数据。例如,如果您的响应有 50 条记录,rowNum = 10 并且 loadonce 设置为 true,则所有 50 条记录都会在本地加载,但在网格中仅显示前 10 条。如果您设置使用寻呼机,则可以使用它可以查看其余记录。
我强烈建议您根据使用的 jqGrid 版本阅读文档 - Guriddo jqGrid 或 free-jqGrid。
关于javascript - 当 loadonce 设置为 true 时分页不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56185867/