//jqgrid checkbox的点击选择事件
multiselect: true,
//点击行,进行单选
//要求:editable:false
onSelectRow: function (rowId, status, e) {
var ids=$('#yourDataGrid').jqGrid('getGridParam','selarrrow');
if(ids.length>0){
$("#xxx").val(JSON.stringify(ids));
}else{
$("#xxx").val("");
}
},
//点击题头的checkbox按钮,一键多选
onSelectAll:function(rowids,statue){
console.log(rowids);
//全选时候,将指定行设置成未选中状态
$('#yourDataGrid').setSelection("1147070265284452352", false);
//rowids是被全选中的行数据的id数组
if(statue){
$("#xxx").val(JSON.stringify(rowids));
}else{
$("#xxx").val("");
}
},
//在选中该行之前的事件,如需要
beforeSelectRow:function(rowid, e){
console.log(rowid);
console.log(e);
if(e.type == 'click'){
console.log("do Something beforeSelectRow");
}
},
//要求:editable:true
onCellSelect: function (rowId, status, e) {
console.log("onCellSelect");
var ids=$('#yourDataGrid').jqGrid('getGridParam','selarrrow');
if(ids.length>0){
$("#xxx").val(JSON.stringify(ids));
}else{
$("#xxx").val("");
}
},
//可以获取点击cell中的列号。输入的值
onCellSelect: function(rowid, iCol, cellcontent,e){
console.log(iCol+"___"+cellcontent);
},