jqGrid根据数据动态设置rowList
1 superme.rowList = [10,20,50,100]; 2 superme.rowNum = 20;
loadComplete : function (data) { if(data.records>100) { $("#rowList").val(superme.rowNum); superme.rowList = [10,20,50,100,data.records]; $("#last_viewShowPager").next().html(" <select id='rowList' class='ui- pg-selbox form-control' role='listbox' title='每页记录数'> <option role='option' value='10'>10</option> <option role='option' value='20'>20</option> <option role='option' value='50'>50</option> <option role='option' value='100'>100</option> <option role='option' value='"+data.records+"'>"+data.records+" </option> </select>"); $("#viewShowGrid").jqGrid("setGridParam", { rowList : superme.rowList, }).trigger('reloadGrid'); } }
$(document).on('change', '#rowList', function(o,n,l) {
superme.rowNum = $("#rowList").val();
$("#viewShowGrid").jqGrid("setGridParam", {
rowNum : superme.rowNum,
}).trigger('reloadGrid');
});