【发布时间】:2017-01-14 12:37:09
【问题描述】:
当我设置 editrules custom_func 和 required=false 时,custom_func 仅在用户输入值时才有效。我的意思是,如果用户将输入留空,jqgrid 会跳过 custom_func。 就我而言,我想验证字段值是否为空,具体取决于同一行中的其他用户值。所以我不能在colmodel中设置required=false,因为我需要在提交后验证它。
这是一个伪custom_func,不要注意它的内容:
colmodel: [
{name:'xxx', editrules: {
required:false,
custom:true,
custom_func: function(value) {
if(othercolumn=='blah' && value=='' ) {
//this is error
} else {
//this is correct
}
}
}}
]
编辑:我正在使用 jqGrid 4.6.0(我仍在单独的分支中测试免费的 4.13.6)
【问题讨论】: