jqGrid - 未显示寻呼机。如何启用它?
我不知道为什么,但我使用 jqGrid 和寻呼机无法正常显示。我可以显示 viewrecords
,但寻呼机不行。表的其余部分工作正常。
有人可以告诉我问题出在哪里吗?
我的 JQGrid 是:
jQuery('#report_table').jqGrid({
scroll: 'true',
url:'getReportTableData.json',
datatype: 'json',
height: 400,
width: 800,
colNames:['Futures','Units'],
colModel:[
{name:'Futures',index:'Futures', width: 150, sortable: false},
{name:'Units',index:'Units', width: 150, sortable: false],
rowNum:100,
loadonce:'false',
shrinkToFit: 'true',
mtype: 'POST',
pager: '#preport_table',
postData: { idReport : '75' },
viewrecords: 'true',
loadComplete : function (data) {
if (data.error == 1){
$('#dialog-modal').dialog({
height: 140, width: 300, modal: true, title: ' Error ',
buttons: { cerrar : function() {
$(this).dialog('close');
}
}
});
$('#dialog-modal').html(msgError(data.msg));
}
},
caption: '',
hidegrid: 'true',
});
html 代码是
<table id='report_table'></table> <div id='preport_table' ></div>
谢谢。
I dont know why, but im using jqGrid and pager not show properly. I could show the viewrecords
, but pager not. The rest of the table works ok.
Could anybody give me any idea about where is the problem.
My JQGrid is:
jQuery('#report_table').jqGrid({
scroll: 'true',
url:'getReportTableData.json',
datatype: 'json',
height: 400,
width: 800,
colNames:['Futures','Units'],
colModel:[
{name:'Futures',index:'Futures', width: 150, sortable: false},
{name:'Units',index:'Units', width: 150, sortable: false],
rowNum:100,
loadonce:'false',
shrinkToFit: 'true',
mtype: 'POST',
pager: '#preport_table',
postData: { idReport : '75' },
viewrecords: 'true',
loadComplete : function (data) {
if (data.error == 1){
$('#dialog-modal').dialog({
height: 140, width: 300, modal: true, title: ' Error ',
buttons: { cerrar : function() {
$(this).dialog('close');
}
}
});
$('#dialog-modal').html(msgError(data.msg));
}
},
caption: '',
hidegrid: 'true',
});
And the html code is
<table id='report_table'></table> <div id='preport_table' ></div>
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的主要问题是
scroll: true
选项。在该选项的文档中,您将找到以下内容:此外,您的代码有一些语法错误,您应该修复这些错误:
colModel
的第二列不包含“}”(请参阅“]”之前)。true
和false
,而不是字符串'true'
和'false'
(请参阅滚动:'true'
,loadonce:'false'
,shrinkToFit:'true'
,viewrecords:'true'
>,hidegrid: 'true'
)You main problem is the
scroll: true
option. In the documentation of the option you will find the following:Moreover your code has some syntax errors which you should fix:
colModel
contain no '}' (see before ']').true
andfalse
and not as strings'true'
and'false'
(seescroll: 'true'
,loadonce:'false'
,shrinkToFit: 'true'
,viewrecords: 'true'
,hidegrid: 'true'
)对于遇到我的问题的其他人,
gridview: true
可能会导致寻呼机不显示。我删除了 gridview 属性,然后出现了寻呼机栏。For others with my problem,
gridview: true
can cause the pager not to show. I removed the gridview property and the pager bar appeared.我准备了一些可运行的 jqGrid 来向您展示如何正确启用寻呼机(基于我在不同的答案)。
滚动和 gridview 属性似乎没有任何区别,我已将它们添加到下面的示例 4 中,并且它仍然有效(这是与网格 3 相比的唯一区别)。
Grid1 显示可滚动的数据,而第二个则显示分页器。
区别在于属性:
其中
viewrecords
只是可选的,用于显示有多少记录可用。省略它可以隐藏记录编号显示。rowNum
参数指定多少您想要查看的每页行数(此处为 4)。请注意,由于此处的高度 (45) 太小,因此它仍然显示垂直滚动条 - 以及寻呼机 (1 of 2)。 Grid2 就是这种情况。
要摆脱滚动条,请增加高度参数的大小。这显示在下面示例中的 Grid3 中。
注意:单击完整页面(单击运行代码片段后的右上角,可以更好地查看网格)。
I've prepared some runnable jqGrids to show you how to enable the pager properly (based on the canonical example I provided in a different answer).
The scroll and gridview properties don't seem to make any difference, I have added those to example 4 below and it still works (it is the only difference compared to grid 3).
Grid1 displays the data just scrollable, while the second one is displaying a pager.
The difference are the properties:
where
viewrecords
is just optional to show how many records are available. Omit it to hide the record number display.The
rowNum
parameter specifies how many rows per page you want to see (here 4).Note that because the height (45) is too small here, it still shows a vertical scrollbar - and the pager (1 of 2) at the same time. This is the case in Grid2.
To get rid of the scrollbar, increase the size of the height parameter. This is shown in the Grid3 in the example below.
Note: Click on Full page (upper right corner after you clicked Run Code Snippet for a better view of the grids).