在jqgrid中验证

Jos*_*eph 8 jquery jqgrid

我目前正在使用ci框架在jqgrid上工作.只想询问jqgrid中的验证.我已经看到,在jqgrid中,列可以像这样验证:editrules:{required:true}},依此类推......

继承了我的问题,我想知道如果客户输入他/她想要的用户名但它已经存在,是否可能.这可能使用jqgrid验证吗?

谢谢 - 迪恩

Rig*_*ong 10

您可以使用自定义编辑规则执行此操作

这是文档中的示例

function mypricecheckforvalue(value, colname) {
if (value < 0 || value >20) 
   return [false,"Please enter value between 0 and 20"];
else 
   return [true,""];
}
jQuery("#grid_id").jqGrid({
...
   colModel: [ 
      ... 
      {name:'price', ..., editrules:{custom:true, custom_func:mypricecheckforvalue....}, editable:true },
      ...
   ]
...
});
Run Code Online (Sandbox Code Playgroud)