jquery – 如果使用loadonce:true,则jqGrid仅返回rowNum中定义的记录

这是正常的还是我错过了什么?

如果我设置loadonce:true,我的网格只返回5条记录.

但是,如果我将其更改为loadonce:false,则网格将获取所有记录

我的代码如下.

$("#leave-detail-grid").jqgrid({
    url:'grid/grid_leave_detail.PHP',datatype: 'xml',mtype: 'GET',colNames:['Date','Day','Approver','Leave Type','Status','Purpose | Reason'],colModel :[
      {name:'start_date',index:'start_date',width:80,editable:false,align:"left",editrules:{required:true}},{name:'day',index:'day',{name:'sup',index:'sup',width:130,{name:'desc',index:'desc',{name:'status',index:'status',align:"center",{name:'purpose',index:'purpose',width:180,editrules:{required:true}}    
    ],height: 'auto',pager: '#leave-detail-pager',pgbuttons: true,pginput: 'Yes',pgtext: 'Yes',rowNum:5,rowList:[20,40,100,200,400],sortname: 'start_date',sortorder: 'asc',loadonce: true,// to enable sorting on client side
    viewrecords: true,gridview: true,caption: 'Search Purpose'
});
$("#leave-detail-grid").jqgrid('navGrid',"#leave-detail-pager",{edit:false,add:false,del:false,search:true},{zIndex:5234},{zIndex:5234}
);

解决方法

谢谢乔纳森.我怎么想念那个演示:)

添加colModel rowTotal:2000,值-1不起作用,这将显示2000 recs

然后将下面添加到我的服务器代码

$totalrows = isset($_REQUEST['totalrows']) ? $_REQUEST['totalrows']: false;
if($totalrows) {
$limit = $totalrows;
}

并加载我们需要的所有记录来调整服务器代码以覆盖rowTotal参数.

$result = MysqL_query("SELECT COUNT(*) AS count FROM leaveform WHERE emp_id='$emp_id'   AND company_id='$company_id'"); 
$row = MysqL_fetch_array($result,MysqL_ASSOC); 
$count = $row['count']; 
$totalrows =  $count;
$limit = $totalrows;

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...