单选需要设置2个属性和2个方法:
multiselect:true,
multiboxonly:true,
onSelectRow: function (rowId, status, e) {
var lastSel;
if (rowId == lastSel) {
$(this).jqGrid("resetSelection");
lastSel = undefined;
status = false;
} else {
lastSel = rowId;
}
},
beforeSelectRow: function (rowId, e) {
$(this).jqGrid("resetSelection");
return true;
},
获取选中行的数据:
var rowid=$("#grid-table").jqGrid("getGridParam","selrow");
var rowData=jQuery("#grid-table").jqGrid("getRowData",rowid);
获取 多行数据:
var ids = $("#grid-table").jqGrid('getGridParam', 'selarrrow');获取 多行数据
var rowData = $("#grid-table").jqGrid('getRowData', ids[i]);
在循环遍历 获取信息