gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 23:04:46 26 4
gpt4 key购买 nike

这是正常现象还是我遗漏了什么?

如果我设置 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', width:80, editable:false, align:"left", editrules:{required:true}},
{name:'sup', index:'sup', width:130, editable:false, align:"left", editrules:{required:true}},
{name:'desc', index:'desc', width:130, editable:false, align:"left", editrules:{required:true}},
{name:'status', index:'status', width:80, editable:false, align:"center", editrules:{required:true}},
{name:'purpose', index:'purpose', width:180, editable:false, align:"left", 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},{zIndex:5234},{zIndex:5234}
);

最佳答案

谢谢乔纳森。我怎么错过了那个演示:)

我添加了 colModel rowTotal: 2000, 值 -1 不起作用,这将显示 2000 个记录

然后将以下内容添加到我的服务器代码

$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;

关于jquery - 如果使用 loadonce :true,jqGrid 仅返回 rowNum 中定义的记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9046431/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com