簡體   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