jqgrid建立、重新整理、銷燬表格
阿新 • • 發佈:2018-11-04
記錄使用jqGrid操作表格的相關方法,方便查詢。。。
建立表格:
//設定功能選項 var option={ data:data, datatype:"local", height:300, colNames:colNames, colModel:colModel, viewrecords:true, rowNum:100, rowList:[100,200,300], pagerpos:"center", pager:1 altRows:true, multiSort:true, multiselect:true, onSelectRow:null, onSelectAll:null, styleUI:'Bootstrap', treeGrid:false, ExpandColumn:false, treeIcons:[{plus:'ui-icon-triangle-l-e',minus:'ui-icon-triangle-l-s',leaf:'ui-icon-radio-off'}], shrinkToFit:false, autowidth:true, gridComplete:function(){}, datastr:data }; //建立表格 jQuery(tableid).jqGrid(option); //page頁 jQuery(tableid).jqGrid('navGrid',pageid,{ edit:false, add:false, del:false, search:true, refresh:true, view:true },{},{},{},{});
重新整理表格:
$(tableid).jqGrid().trigger("reloadGrid");
帶參重新整理表格:
$(tableid).jqGrid('setGridParam',{
url:"",
postData:{param1:param1,param2:param2},
gridComplete:function(){...},
page:1
}.trigger('reloadGrid');
銷燬表格:
$.jqgrid.gridUnload(tableid);
或
$(tableid).jqGrid('GridUnload');
持續更新中。。。