资源描述:
《jqgrid方法大全》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1.获得当前列表行数:$("#gridid").getGridParam("reccount");2.获取选中行数据(json):$("#gridid").jqGrid('getRowData',id);3.刷新列表:$(refreshSelector).jqGrid('setGridParam',{url:''),postData:''}).trigger('reloadGrid'); 4.选中行:$("#jqGrid").setSelection("1",true); (Togglesaselectionofthe
2、rowwithid= rowid;if onselectrow istrue(thedefault)thentheeventonSelectRowislaunched,otherwiseitisnot.)//true:重新加载表格数据,false:不重新加载表格数据5.重置选中行:$("#jqgrid").resetSelection();//Resets(unselects)theselectedrow(s).Alsoworksinmultiselectmode.6.清除:$("#jqgrid").clearGridDa
3、ta(); //Clearsthecurrentlyloadeddatafromgrid.Iftheclearfooterparameterissettotrue,themethodclearsthedataplacedonthefooterrow.7. $("#jqgrid").setCell(rowid,colname,nData,cssp,attrp); //Thismethodcanchangethecontentofparticularcellandcansetclassorstyleproperties.W
4、here: rowid theidoftherow, colname thenameofthecolumn(thisparametercanbeanumber(theindexofthecolumn)beginningfrom0 45/45data thecontentthatcanbeputintothecell.Ifemptystringthecontentwillnotbechanged class ifclassisstringthenweaddaclasstothecellusingaddClass;ifclas
5、sisanarraywesetthenewcsspropertiesviacss properties setstheattributeproperiesofthecell, forceup Iftheparameterissettotrueweperformupdateofthecellinsteadthatthevalueisempty 8.获取选中行ID varrowid=$("#jqgrid").jqGrid('getGridParam','selrow'); varrowid=$("#searchResultL
6、ist").getGridParam("selrow"); varrowData=$("#searchResultList").getRowData(rowid);/根据行ID,获取选中行的数据(根据)=================重点讲解================1.1prmNames选项prmNames是jqGrid的一个重要选项,用于设置jqGrid将要向Server传递的参数名称。其默认值为: 45/45viewplain1.prmNames : { 2. page:"page", // 表
7、示请求页码的参数名称 3. rows:"rows", // 表示请求行数的参数名称 4. sort: "sidx", // 表示用于排序的列名的参数名称 5. order: "sord", // 表示采用的排序方式的参数名称 6. search:"_search", // 表示是否是搜索请求的参数名称 7. nd:"nd", // 表示已经发送请求的次数的参数名称 8. id:"id", // 表示当在编辑数据模块中发送数据时,使用的id的名称 9. oper:
8、"oper", // operation参数名称(我暂时还没用到) 10. editoper:"edit", // 当在edit模式中提交数据时,操作的名称 11. addoper:"add", // 当在add模式中提交数据时,操作的名称 12. deloper:"del