假设我需要发送参数" rows" :10为服务器的分页,由jqGrid中的rowNum值发送,但服务器给我超过10行,让20说。现在我需要在一页显示20行而不是10但由于rowNum设置为10我的表显示10只有行。如何在服务器响应后显示20行?
任何帮助将不胜感激。感谢。
<script type="text/javascript">
$(function () {
$("#list").jqGrid({
url: "/show_stock.json",
mtype: "GET",
styleUI : 'Bootstrap',
datatype: "json",
colModel: [
{ label: 'Product', name: 'uiproduct_id', key: true, width: 440, formatter: function productFormatter( cellvalue, options, rowObject )
{
return '<div> <img src="http://limeroad-prod.s3.amazonaws.com/uiproducts/' +
rowObject.uiproduct_id + '/tn_0-' + rowObject.fileidn + '.jpg"/>' + rowObject.lrName +
"<div>"+ "Brand: " + rowObject.brand_name + "</div><div>" + "UPID: " + cellvalue +
"</div></div>";
},
cellattr: function (rowId, val, rawObject, cm) {
var attr = rawObject.attr[cm.name], result;
if (attr.rowspan) {
result = ' rowspan=' + '"' + attr.rowspan + '"';
} else if (attr.display) {
result = ' style="display:' + attr.display + '"';
}
return result;
}
},
{ label: ' VendorStyle Code', name: 'vendor_style_code', width: 200, align: 'center', formatter: function styleCodeFormatter( cellvalue, options, rowObject )
{
return cellvalue + " (" + rowObject.size + ")";
}
},
{ label: 'MRP', name: 'mrp', width: 150, align: 'center' },
{ label: 'Selling Price', name: 'selling_price', defval: '145', width: 150, align: 'center', formatter: function sellingPriceFormatter( cellvalue, options, rowObject)
{
return rowObject.mrp - (rowObject.discount * rowObject.mrp / 100);
}
},
{ label: 'Discount', name: 'discount', width: 150, align: 'center' },
{ label:'Stock', name: 'quantity', width: 150, align: 'center', editable: true}
],
width: 780,
height: 400,
pager: '#mypager',
viewrecords: true,
rowNum:10,
rowList:[10,20,30],
gridview: true,
viewrecords: true,
cellEdit: true,
cellsubmit: 'remote',
cellurl: '/update_stock.json',
afterSubmitCell: function (serverStatus, rowid, cellname, value, iRow, iCol) {
var response = trim(serverStatus.responseText);
if (response != 'ok') {
return [true,""];
} else {
return [false,response];
}
}
});
});
</script>