- 注册时间
 - 2013-3-14
 - 最后登录
 - 2025-5-15
 - 阅读权限
 - 10
 - 积分
 - 1604
 - 精华
 - 0
 - 帖子
 - 213
  
 
 
 
   
 | 
felt 发表于 2017-8-24 13:17   
row就是你这个e.record,行对象啊。  
我这样写了之后,发现单元格就不验证了,直接提交了到服务器了,不知道是哪里出问题了:- //单元格验证
 
 - function onCellValidation(record){
 
 - if(record.state!="在家务农"){
 
 -     //mini.alert("目前状况不能录入,请与帮扶责任人联系!");
 
 -     e.isValid=false;
 
 - }
 
 - if(record.publicworkname!=""&&record.employdate!=""&&record.subsidy!=""&&record.operator!=""&&record.operatortelephone!=""){
 
 - e.isValid=true;
 
 - }
 
 - e.isValid=false;
 
 - }
 
  
 
- grid.on("cellendedit", function (e) {
 
  
- var grid = e.sender;
 
 - var record = e.record;
 
 - var field = e.field, value = e.value;
 
 - //指定行进行验证
 
 - if(field=="publicworkname"||field=="employdate"||record=="subsidy"||record=="operator"||record=="operatortelephone"){
 
 - grid.validate(record);
 
 - if(grid.isValid()){
 
 - saveData();
 
 - }
 
 - }
 
 - })
 
  
 
 
- //编辑保存
 
 - function saveData() {
 
 - var data = grid.getChanges();
 
 - var json = mini.encode(data);
 
 - grid.loading("保存中,请稍后......");
 
 - $.ajax({
 
 - url: "<?= Url::to(['poor-public-work/save-public-work-info']) ?>",
 
 - data: { keyWord: json,_csrf:csrfToken },
 
 - type: "post",
 
 - success: function (text) {
 
 - grid.reload();
 
 - },
 
 - error: function (jqXHR, textStatus, errorThrown) {
 
 - alert(jqXHR.responseText);
 
 - }
 
 - });
 
 - }
 
  复制代码 |   
 
  
 |