【发布时间】:2012-11-02 08:25:21
【问题描述】:
我对这个问题很困惑,因为我是 jqGrid 的新手。 我的数据只显示 10 行。这是我的脚本;
jQuery("#list").jqGrid({
url:'dounfinish.php?q=1',
datatype: 'json',
mtype: 'POST',
closeafteredit:true,
colNames:['id','Date', 'Line','Model','Lotno','Qty','PIC'],
colModel :[
{name:'id', index:'id', hidden:true, width:55},
{name:'Date', index:'Date', width:90, editable:true, search:true, stype:'text',searchoption:{sopt:['cn']}},
{name:'Line', index:'Line', width:80, editable:true, search:true, stype:'text',searchoptions:{sopt:['cn']}},
{name:'Model', index:'Model', width:180, editable:true, search:true, stype:'text',searchoption:{sopt:['cn']}},
{name:'Lotno', index:'Lotno', width:80, editable:true, search:true, stype:'text',searchoption:{sopt:['cn']}},
{name:'Qty', index:'Qty', width:80, editable:true, search:true, stype:'text',searchoptions:{sopt:['cn']}},
{name:'PIC', index:'PIC', width:180, editable:true, search:true, stype:'text',searchoption:{sopt:['cn']}}
],
// pager: jQuery('#pager'),
gridview:true,
pager: '#pager',
width: '100%',
height: '100%',
rowNum:10,
rowList:[10,20,30],
sortname: 'Date',
sortorder: "desc",
viewrecords: true,
loadonce: true,
// imgpath: 'themes/basic/images',
caption: 'DAILY CHECK QTY',
editurl:'process3.php',
prmNames:{oper:'action',editoper:'editbaldefect',id:'def_id'}
});
这样的情况:
loadonce: true result View 1 - 10 of 10 --> column filter can work.
loadonce: false result View 1 - 10 of 3500 --> column filter not working.
为什么?
在开发者工具展上:
{"page":1,"total":33223,"records":"332222","rows":[]}
但在 php 页面出现:
更新
我的 jqgrid 使用datetype : json,还需要loadonce : true。我已经像这样试用了:
- change loadonce : false --> 结果显示所有记录但不能使用工具栏过滤器
- change loadonce : true --> 结果只显示 10 条记录,但工具栏过滤器可以工作
- loadonce : true, rowNum: 50 --> 数据仅显示 50(下一个按钮禁用)
- 在 phpmyadmin 检查查询 --> 结果所有数据都可以显示(查询 OK)
- 使用另一个表(OK)-->结果还是不行
- 使用另一个页面然后附加 jqgrid --> 还是不行
为什么 jqgrid 只检索 10 条记录而该表实际上有 100.000 条记录? 以及为什么只有这张桌子而另一张桌子可以工作。
【问题讨论】:
标签: jquery json jqgrid filtering