我设置了一个jqGrid来检索放入搜索表单的所有数据行。
如果返回的行数 20或更少,则在网格中显示数据没有问题。我没有或想要任何分页设置。
但是,如果超过20行返回,则网格会翻转而没有特定错误,并且不会返回数据。
下面是我对网格的JS定义。
有人可以告诉我,我在定义中缺少哪些成功撤回20多行?
HTML
<div id="jqGrid_container">
<table id="fuelTicketsGrid" class="table table-condensed"></table>
<div id="GridPager"></div>
</div>
JS
$('#fuelTicketsGrid').jqGrid({
jsonReader: { root: 'tkts', repeatitems: true },
width: 'auto',
height: 'auto',
autowidth: true,
rownumbers: false,
rownumWidth: 30,
loadonce: true,
edit: false,
viewRecords: true,
gridview: true,
emptyRecords: "No records found",
caption: "Fuel Tickets",
onCellSelect: function (rowid, iCol, cellcontent) {
var grid = $('#fuelTicketsGrid');
var imageID = grid.jqGrid('getCell', rowid, 'Image_ID');
if (imageID != "")
DisplayReceipt(imageID);
},
colModel: [
{ name: 'FuelTkt_ID', label: 'ID', width: 20, align: "right" },
{ name: 'Ticket_No', label: 'Ticket', width: 60, align: "right" },
{ name: 'Customer_Name', label: 'Customer', width: 150 },
{ name: 'Vehicle_No', label: 'Vehicle', width: 60 },
{ name: 'Trans_Timestamp', label: 'Date', width: 100, formatter: 'date', formatoptions: { newformat: 'l, F d, Y g:i:s A' } },
{ name: 'Image_ID', label: 'Image ID', width: 150 },
]
});
$('#fuelTicketsGrid').jqGrid('navGrid', { add: false, edit: false, del: false, search: false, refresh: false });
答案 0 :(得分:2)
问题的原因很容易。 jqGrid执行始终数据分页,rowNum
指定的页面大小值为20(请参阅the page选项中表格中“默认”列的值)。因此,应该包含pager
或toppager: true
选项,以允许用户更改页面或将rowNum
选项设置为足够大的值rowNum: 10000
。
顺便说一句,你使用'navGrid'
的错误选项。如果您不需要寻呼机和导航栏,则不应使用该方法。如果您确实使用它,则应为第二个参数指定正确的值(寻呼机选择器)(参见the documentation)。