繁体   English   中英

如何在 jsGrid 中自定义验证器警报?

[英]How customize the validators alerts in jsGrid?

我找不到在 jsGrid 中自定义验证器警报的方法。 我可以更改验证规则,但我需要使用自定义函数并删除警报。

我也找不到对输入无效数据的引用 消息,这是required警报中的默认值。

我尝试遵循 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"
        }]
    });
};

如果你想修改“输入的数据无效!”,你可以在你的代码中添加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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM