jQuery MiniUI

 找回密码
 立即注册
查看: 1093|回复: 3
打印 上一主题 下一主题

mini-grid如何实现关联校验 [复制链接]

Rank: 6Rank: 6

跳转到指定楼层
楼主
发表于 2022-9-16 18:01:25 |只看该作者 |倒序浏览
A和B两个单元格,A单元格有错误提示,修改B单元格满足条件后如何将A单元格的错误提示去掉?
目前表格绑定有oncellvalidation事件,怎么处理上面的问题?

Rank: 8Rank: 8

沙发
发表于 2022-9-19 09:12:00 |只看该作者
<div field="a" name="aa" width="120" headerAlign="center" allowSort="true">a
                <input property="editor" class="mini-textbox" style="width:100%;" />
            </div>  
            <div field="b"  width="120" headerAlign="center" allowSort="true">b
                <input property="editor" class="mini-textbox" style="width:100%;" />
            </div>

function onCellValidation(e) {
           
            if (e.field == "a") {
                if (e.record.b == 1) {

                } else {
                    e.isValid = false;
                    e.errorText = "不能为空";
                }
            }
            if (e.field == "b") {
                grid.validateCell(e.record, "aa");     
            }
        }b列验证完主动去验证同行a列。

Rank: 6Rank: 6

板凳
发表于 2022-9-19 18:02:16 |只看该作者
felt 发表于 2022-9-19 09:12
a
               
              

a单元格onCellValidation时,grid.validateCell(e.record, "bb");  
b单元格onCellValidation时,grid.validateCell(e.record, "aa");  
这样会不会造成循环?

Rank: 8Rank: 8

地板
发表于 2022-9-20 10:19:20 |只看该作者
哎呀 发表于 2022-9-19 18:02
a单元格onCellValidation时,grid.validateCell(e.record, "bb");  
b单元格onCellValidation时,grid.va ...

Archiver|普加软件

GMT+8, 2024-5-23 00:01 , Processed in 1.039287 second(s), 9 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部