[英]How customize the validators alerts in jsGrid?
I can not find a way to customize validator alerts in jsGrid.我找不到在 jsGrid 中自定义验证器警报的方法。 I can change the validation rule, but I need to use a custom function and remove the alert.我可以更改验证规则,但我需要使用自定义函数并删除警报。
Also I can not find a reference to the Invalid data entered!我也找不到对输入的无效数据的引用! Message, which is the default in the required
alert.消息,这是required
警报中的默认值。
I tried to follow some tips from some topics in github, I also followed the documentation to use invalidNotify
, but without success.我尝试遵循 github 中某些主题的一些提示,我也遵循文档使用invalidNotify
,但没有成功。
I'm trying using a custom function, which besides validating already makes some changes in the layout to notify that the inserted data is invalid.我正在尝试使用自定义函数,除了验证已经在布局中进行了一些更改以通知插入的数据无效。
However, the standard jsGrid alert keeps popping up, as below:但是,标准的 jsGrid 警报不断弹出,如下所示:
fields: [{
name: "sensorNumber",
title: $('#title_meter_number').val(),
type: "number",
validate: function(config) {
if (config == undefined) {
__validateRefuelling(config);
}
I got it with invalidNotify
, I had used it erroneously before, it follows my code:我用invalidNotify
得到了它,我之前错误地使用了它,它遵循我的代码:
var xxx = function() {
$('#xxx').jsGrid({
height: '250px',
width: '100%',
inserting: true,
editing: true,
sorting: true,
invalidNotify: function(args) {
$('#alert-error-not-submit').removeClass('hidden');
},
fields: [{
name: "sensorNumber",
title: $('#title_meter_number').val(),
type: "number",
validate: "required"
}, {
name: "liters",
title: $('#title_liters').val(),
type: "number",
validate: "required"
}, {
name: "measuredValue",
title: $('#title_indication_of_the_meter').val(),
type: "number",
validate: "required"
}, {
type: "control"
}]
});
};
If you want to modify "Invalid data entered!",you can add invalidMessage
in your code,I tried it works如果你想修改“输入的数据无效!”,你可以在你的代码中添加invalidMessage
,我试过了
$("#grid").jsGrid({ height:"auto", width:"100%", autoload:true, editing:true, paging:true, invalidMessage:"your error msg", ... }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.