//获取Grid所选行的ID
var GridId=$(grid_selector).jqGrid('getGridParam','selrow');
//通过GridId获得所选行数据
var selectRow = $(grid_selector).jqGrid('getRowData',GridId);
//console.log(selectRow.id);
//console.log(selectRow['id']);
var id = selectRow.id;
jqGrid自带多选,实现单选的方法;
以下三个属性缺一不可:
[html] view plain copy
multiselect: true,
multiboxonly:true,
beforeSelectRow: beforeSelectRow,//js方法
[html] view plain copy
function beforeSelectRow()
{
$("#jqgridId").jqGrid('resetSelection');
return(true);
}