ondblClickRow: function(id){
if(id && id !== lastsel){
var rowData = $("#jqGridId").jqGrid("getRowData", id);
$('#jqGridId').jqGrid('restoreRow',lastsel);
$('#jqGridId').jqGrid('editRow',id,{
keys : true, //这里按[enter]保存
url: s2web.appURL + "jq/save.action",
mtype : "POST",
restoreAfterError: true,
extraparam: {
"ware.id": rowData.id,
"ware.warename": $("#"+id+"_name").val(),
"ware.createDate": $("#"+id+"_date").val(),
"ware.number": $("#"+id+"_amount").val(),
"ware.valid": $("#"+id+"_type").val()
},
oneditfunc: function(rowid){
console.log(rowid);
},
succesfunc: function(response){
alert("save success");
return true;
},
errorfunc: function(rowid, res){
console.log(rowid);
console.log(res);
}
});
}
}
jQuery("#grid_id").jqGrid('editRow',rowid, keys, oneditfunc, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc);
jQuery("#grid_id").jqGrid('editRow',rowid, {
"keys" : false,
"oneditfunc" : null,
"successfunc" : null,
"url" : null,
"extraparam" : {},
"aftersavefunc" : null,
"errorfunc": null,
"afterrestorefunc" : null,
"restoreAfterError" : true,
"mtype" : "POST"
});
$("#addBtn").bind("click", function() {
$("#jqGridId").jqGrid('addRow',{
rowID : "new_row",
initdata : {},
position :"first",
useDefValues : true,
useFormatter : true,
addRowParams : {extraparam:{
}}
});
//当前新增id进入可编辑状态
$('#jqGridId').jqGrid('editRow','new_row',{
keys : true, //这里按[enter]保存
url: s2web.appURL + "jq/save.action",
mtype : "POST",
restoreAfterError: true,
extraparam: {
},
oneditfunc: function(rowid){
console.log(rowid);
},
succesfunc: function(response){
alert("save success");
return true;
},
errorfunc: function(rowid, res){
console.log(rowid);
console.log(res);
}
});
});