我找不到在 jsGrid 中自定义验证器警报的方法。我可以更改验证规则,但我需要使用自定义函数并删除警报。
我也找不到对输入无效数据!消息的引用,这是必需
警报中的默认值。
我尝试按照 github 中一些主题的一些提示,我也按照文档使用 invalidNotify
,但没有成功。
我正在尝试使用自定义函数,除了验证之外,它已经对布局进行了一些更改以通知插入的数据无效。
但是,标准的 jsGrid 警告不断弹出,如下所示:
fields: [{
name: "sensorNumber",
title: $('#title_meter_number').val(),
type: "number",
validate: function(config) {
if (config == undefined) {
__validateRefuelling(config);
}
最佳答案
我是用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"
}]
});
};
关于javascript - 如何自定义 jsGrid 中的验证器警报?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51285449/