<div class="gridPanel" id="gridPanel"> <table id="gridTable"></table> <div id="gridPager"></div>
</div>
function getGrid(){ $("#gridPanel").empty(); $("#gridPanel").append("<table id='gridTable'></table><div id='gridPager'></div>"); var beginTime = $("#beginTime").val(); var endTime1 = $("#endTime").val(); var endTime=getLastDay(endTime1); var $gridTable=$("#gridTable"); var url=basePath+"operatingIncome/operatingIncome/operating_income_data.action"; $gridTable.jqGrid({ url:url, postData:{'beginTime':beginTime,'endTime':endTime}, datatype:"json", height: ($(document).height() - 300)/2, autowidth:true, colModel:[ { label: '时间', name: 'time', index: 'time', width: 150, align: 'center' ,sortable:false}, { label: '线路总数', name: 'totalLine', index: 'totalLine', width: 150, align: 'center' ,sortable:false}, ], viewrecords:true, rowNum:5, rowList:[5,10,20], pager:"#gridPager", sortname: 'code', sortorder: 'asc', rownumbers:true, shrinkToFit:false, gridview: true, multiselect: true, multiboxonly:true, onSelectRow : function() { }, gridComplete : function() { } }); }