8
即时通讯工作在使用ci框架的jqgrid。只是想问一下jqgrid中的验证。我已经看到,在jqgrid列可以像这样验证:editrules:{required:true}},等等......验证在jqgrid
继承人我的问题,我想知道是否有可能,如果客户进入他/她所需的用户名,但它已经存在。这是可能的使用jqgrid验证?
感谢 -Dean
即时通讯工作在使用ci框架的jqgrid。只是想问一下jqgrid中的验证。我已经看到,在jqgrid列可以像这样验证:editrules:{required:true}},等等......验证在jqgrid
继承人我的问题,我想知道是否有可能,如果客户进入他/她所需的用户名,但它已经存在。这是可能的使用jqgrid验证?
感谢 -Dean
您可以使用custom edit rule
这是文档
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 },
...
]
...
});
在这里的例子是一个解决方案,我想通了
{name:'actualNo',index:'actualNo',editable:true, edittype:"text", width:150,editoptions:{
size: 15, maxlengh: 10,
dataInit: function(element) {
$(element).keyup(function(){
var val1 = element.value;
var num = new Number(val1);
if(isNaN(num))
{alert("Please enter a valid number");}
})
}
}},
做到这一点