打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
EditorGridPanel 修改数据

这种方法是捕获EditorGridPanel 的afterEdit事件,就是每次编辑完一个列之后就提交到后台进行修改操作

 

listeners:{
      afterEdit:function(e){
       if(e.value&& e.originalValue !==e.value){
        Ext.Ajax.request({
         url:'jsp/insurance/ins_prove_bl/dispose/updateDate.jsp',
         success:function(response, opts){
          varresObj = Ext.decode(response.responseText);
          if(resObj.success){
           Ext.example.msg('系统提示','操作已完成');
           e.record.commit();
          }else {
           Ext.MessageBox.error("错误","服务器未正确响应。请稍候重试或与管理员联系。");
          }
         },
         failure:function(response, opts){
          Ext.MessageBox.error("错误","无法提交请求,请检查网络连接");
         },
         params:{
          ipId:recordId,
          ipdId:e.record.get('id'),
          updateField:e.field,    //列名
          updateValue:e.value ? Ext.util.Format.date(new Date(e.value),'Y-m-d') :''  //值
         }
        });
      }
    }
  }

 

红色的两行是关键代码,updateField是你要修改的列名,updateValue是你修改之后的值,这是因为你页面上可能有多个可编辑项,这样动态的取是很科学滴

 

后台取值代码

  String updateField =request.getParameter("updateField");
  String updateValue =request.getParameter("updateValue");

  updateField就是你要修改的数据库的列名,updateValue 就是值

  if(updateField != null&& updateValue!=null){
     updateString += " a."+updateField+" = '"+updateValue+"' ";
  }

 

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
ext - ajax
ExtJs 备忘录(4)—— Form表单(四) [ 数据提交 ]
Ext.Ajax.request使用说明
fetch源码分析
jQuery UI Autocomplete是jQuery UI的自动完成组件
ExtJs Ajax
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服