jQuery学习笔记--JqGrid相关操作 方法列表 备忘
来源:互联网 发布:购物车数据分析 编辑:程序博客网 时间:2024/04/25 20:10
文章转载:http://blog.csdn.net/jpr1990/article/details/6891115
怎样获取某一方某一列的值:
var rowdata=jQuery("#list").jqGrid('getRowData',num); var emergencySencondMgrId = rowdata["emergencySencondMgrId"];//列名和jGrid定义时候的值一样 alert(emergencySencondMgrId);
1.获得当前列表行数:$("#gridid").getGridParam("reccount");
2.获取选中行数据(json):$("#gridid").jqGrid('getRowData', id);
3.刷新列表:$(refreshSelector).jqGrid('setGridParam', { url: ''), postData: ''}).trigger('reloadGrid');
4.选中行:$("#jqGrid").setSelection("1", true); (Toggles a selection of the row with id = rowid; if onselectrow is true (the default) then the event onSelectRow is launched, otherwise it is not.)//true:重新加载表格数据, false:不重新加载表格数据
5.重置选中行:$("#jqgrid").resetSelection(); //Resets (unselects) the selected row(s). Also works in multiselect mode.
6.清除:$("#jqgrid").clearGridData(); //Clears the currently loaded data from grid. If the clearfooter parameter is set to true, the method clears the data placed on the footer row.
7. $("#jqgrid").setCell(rowid,colname,nData,cssp,attrp);
//This method can change the content of particular cell and can set class or style properties. Where:
colname the name of the column (this parameter can be a number (the index of the column) beginning from 0
data the content that can be put into the cell. If empty string the content will not be changed
class if class is string then we add a class to the cell using addClass; if class is an array we set the new css properties via css
properties sets the attribute properies of the cell,
8.获取选中行ID
var rowid = $("#jqgrid").jqGrid('getGridParam','selrow');
var rowid = $("#searchResultList").getGridParam("selrow");
var rowData = $("#searchResultList").getRowData(rowid); //根据行ID,获取选中行的数据(根据)
//获取选中的多行ID列表
var selectedIds = jQuery("#stationList").jqGrid("getGridParam","selarrrow"); 允许多行选择时使用
=================重点讲解================
1.1 prmNames选项
prmNames是jqGrid的一个重要选项,用于设置jqGrid将要向Server传递的参数名称。其默认值为:
- prmNames : {
- page:"page", // 表示请求页码的参数名称
- rows:"rows", // 表示请求行数的参数名称
- sort: "sidx", // 表示用于排序的列名的参数名称
- order: "sord", // 表示采用的排序方式的参数名称
- search:"_search", // 表示是否是搜索请求的参数名称
- nd:"nd", // 表示已经发送请求的次数的参数名称
- id:"id", // 表示当在编辑数据模块中发送数据时,使用的id的名称
- oper:"oper", // operation参数名称(我暂时还没用到)
- editoper:"edit", // 当在edit模式中提交数据时,操作的名称
- addoper:"add", // 当在add模式中提交数据时,操作的名称
- deloper:"del", // 当在delete模式中提交数据时,操作的名称
- subgridid:"id", // 当点击以载入数据到子表时,传递的数据名称
- npage: null,
- totalrows:"totalrows" // 表示需从Server得到总共多少行数据的参数名称,参见jqGrid选项中的rowTotal
- }
可以通过这个选项来自定义当向Server发送请求时,默认发送的参数名称。
这个参数很重要也很有用,正是通过这个参数,可以方便的改变默认的request的参数,以符合Server端的需要。比如在prmNames中search默认的值为"_search",这在Struts2的Action中不太方便命名成员变量和getter/ setter。因此可以使用 prmNames: {search: 'search'} 来改变这一默认值为"search",这在Struts2的Action对象中就很好设置getter/ setter了,即getSearch()和setSearch()。当然其他名字也是可以的。
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要) .
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要) .
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- JqGrid相关操作备忘 方法列表
- JqGrid相关操作备忘 方法列表
- JqGrid相关操作备忘
- jQuery学习笔记--jqGrid方法列表 官方文档!
- 修改xml的节点数据内容
- android webView相关知识点
- 自然科学基金项目申报
- Openstack Nova Security Group——安全组之架构篇
- C#学习笔记4
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘
- 领导的八大巅峰智慧
- 扩展的五个阶段
- INSERT INTO SELECT和SELECT INTO两种表复制语句
- dbus学习的资料
- Android如何让软键盘出现和消失
- Concurrency patterns_Java design pattern
- 读文有感。
- Delphi中獲取GUID的函數