jgGrid相关操作--jQuery学习笔记

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();
//Clear the currently loaded from. If the clear footer parameter is set to true,the method clears the data placed on the footer row.

7. 改变单元格内容或修改单元格格式:

$("#jqgrid").setCell(rowid,colname,nData,cssp,attrp); 
//rowid the id of the row, 
//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, 
//forceup If the parameter is set to true we perform update of the cell instead that the value is empty

8.获取选中行ID :

var rowid = $("#jqGrid").jqGrid('getGridParam','selrow');

 

9.获取某一行某一列的值:

var rowdata = $("#jgGrid").jgGrid('getRowData',num);
var celldata = rowdata['cellID']//列名


 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值