jqGrid单元格编辑后切换焦点直接提交

xiaoxiao2021-02-28  147

今天有项目需求,需要直接在jqGrid上编辑数据,可以采用按钮方式提交(该篇不涉及这种方式),这里说的直接切换焦点后提交,刚开始设置cellurl后,不知道怎么传递参数到服务器,查了查官方网站,用自带的事件beforeSubmitCell即可传递,前端代码如下:

// 单元格编辑 cellEdit:true, cellurl:"../../../param/updateCell.do", beforeEditCell :function(rowid, cellname, value, iRow, iCol){ // 记录修改之前的代码名称 oldCodeName = value; }, beforeSubmitCell :function(rowid, cellname, value, iRow, iCol){ // 传递参数 return {"oldValue" : oldCodeName,"newValue" : value,"dmlb" : dmlbTemp}; },controller里对应方法如下

@RequestMapping("/updateCell.do") @ResponseBody public String saveCell(String oldValue,String newValue,String dmlb) { //实现 } 官方网站:http://www.trirand.com/jqgridwiki/doku.php?id=wiki:cell_editing#what_is_posted_to_the_server

转载请注明原文地址: https://www.6miu.com/read-23815.html

最新回复(0)