这是正常的还是我错过了什么?
如果我设置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;