您的位置:首页 > 产品设计 > UI/UE

easyui datagrid 前台批量传递数据到后台_json

2017-04-12 16:32 477 查看
前台:

var rows  = $('#mygrid').datagrid("getRows");
$.post(
sunny.contextPath + '/dutyManage/addMonthDutyIntoDB.do',
{
data:JSON.stringify(rows)
}, function(result) {
var success=result.success;
if(success){

}else{
$.messager.progress('close');
$.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>'+result.info+'</strong></font>',
'warningSunnyIcon',function(){
parent.$('#monthDutyAddDialogId').dialog('close');
});
return;
}
},
'json'
);


后台:

@RequestMapping(value="/addMonthDutyIntoDB",method=RequestMethod.POST)
public @ResponseBody Map<String, Object> addMonthDutyIntoDB(
@RequestParam(required=false,value="data")String data,
@RequestParam(required=false,value="unitId")Integer unitId,
@RequestParam(required=false,value="normalFlag")Integer normalFlag
){
net.sf.json.JSONArray jsonArray=net.sf.json.JSONArray.fromObject(data);
List<Duty> dutyList=jsonArray.toList(jsonArray, Duty.class);
Map<String, Object> map=new HashMap<String, Object>();

if (null!=map) {
map.put("success", true);
} else {
map.put("success", false);
}
return map;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐