Jquery 如何在Spring3MVC内联编辑中将jqgrid点符号数据返回到服务器
我试图用点符号数据显示jqgrid,应该进行内联编辑。在这里,我可以用点符号显示jqgrid数据,也可以进行内联编辑。为了保存内联编辑,我应该将嵌套对象返回到服务器。但是,它不会返回嵌套对象。请帮帮我。提前谢谢 JSON数据:Jquery 如何在Spring3MVC内联编辑中将jqgrid点符号数据返回到服务器,jquery,jqgrid,Jquery,Jqgrid,我试图用点符号数据显示jqgrid,应该进行内联编辑。在这里,我可以用点符号显示jqgrid数据,也可以进行内联编辑。为了保存内联编辑,我应该将嵌套对象返回到服务器。但是,它不会返回嵌套对象。请帮帮我。提前谢谢 JSON数据: { "auditSchedule": null, "jqFlexResponse": { "page": 1, "rpage": null, "sortIndex": null, "sortO
{
"auditSchedule": null,
"jqFlexResponse": {
"page": 1,
"rpage": null,
"sortIndex": null,
"sortOrder": "ASC",
"searchColumn": null,
"searchQuery": null,
"totalPages": null,
"total": 6,
"rows": [
{
"id": 1217,
"checklistItem": {
"id": 78,
"code": "19",
"clause": "Information Security Policy Document"
},
"remark": "sdf",
"reportedStatus": "PARTIALLY_COMPLETE",
"recordInfo": {
"createdBy": "ebudaru",
"createdDate": 1407578162000,
"modifiedBy": "ebudaru",
"modifiedDate": 1407649750000
},
"auditSchedule": {
"id": 280,
"afrsubmitDate": null
}
},
{
"id": 1218,
"checklistItem": {
"id": 78,
"code": "19",
"clause": "Information Security Policy Document"
},
"remark": "hello",
"reportedStatus": "COMPLETE",
"recordInfo": {
"createdBy": "ebudaru",
"createdDate": 1407578162000,
"modifiedBy": "ebudaru",
"modifiedDate": 1407649763000
},
"auditSchedule": {
"id": 280,
"afrsubmitDate": null
}
}
]
}
}
JQGrid设置:
colNames: ["Id", "checklist Id","code","clause", "Reported Status","Remark",
"AuditSchedule Id",
"status", "recordInfo","createdBy","createdDate"],
colModel: [
{ name: "id", width: 25 },
{ name: "checklistItem.id", width: 25 },
{ name: "checklistItem.code", width: 25},
{ name: "checklistItem.clause", width: 25},
{ name: "reportedStatus", width:150, editable: true, edittype:'select',
editoptions:{ value:{COMPLETE:'COMPLETE', PARTIALLY_COMPLETE:'PARTIALLY_COMPLETE', NOT_COMPLETE:'NOT_COMPLETE'} }},
{ name: "remark", editable: true, edittype:'text', editoptions: {rows:"3",cols:"20"} },
{ name: "auditSchedule.id", width: 25 },
{ name: "status", width: 25 },
{ name: "recordInfo", width: 25 },
{ name: "recordInfo.createdBy", width: 25 },
{ name: "recordInfo.createdDate", width: 120,
formatter: function(cellval, opts){
return $.format.date(cellval, 'yyyy-MM-dd HH:mm:ss');
}, }
],
jsonReader: {
root: "jqFlexResponse.rows",
page: "page",
total: "total",
repeatitems: false
},
pager: "#auditFindingPager",
rowNum: 5,
rowList: [5, 10, 20],
viewrecords: true,
gridview: true,
autoencode: true,
});
$("#auditFindingsGrid").jqGrid('editRow', id,
{
keys : true,
url : '../auditFindings/'+id,
oneditfunc: function (id){
},
extraparam:{
clause : fetchColValue(id, 'checklistItem.clause'),
documentURL:fetchColValue(id,'documentURL'),
checklistIdid : fetchColValue(id,"checklistItem.id"),
createdBy : fetchColValue(id,'recordInfo.createdBy'),
createdDate : fetchColValue(id,'recordInfo.createdDate'),
oper: 'UPDATE'
}
});
}
控制器类:
@RequestMapping(value = "/{id}", method = RequestMethod.POST)
public @ResponseBody
ModelAndView editAuditFinding(
@ModelAttribute("auditFinding") AuditFinding auditFinding
@RequestParam(value = "oper", required = true) Operation operation,
HttpSession session) {
logger.info("edit finding Invoked");
}
在这里,我只得到auditFinding数据..仅包括平均值、id、备注和reportedStatus。我还需要获取checklistitem和auditschedule数据。请帮帮我。根据您的代码和jqgrid文档中有效的jsonReader语法,您的jsonReader似乎格式不正确。这些是jsonReader中的有效值
您是否检查过jsonReader中的所有内容都是正确的,这一定是问题所在。根据你在这里看到的,看起来你的语法是错误的