简体   繁体   中英

How customize the validators alerts in jsGrid?

I can not find a way to customize validator alerts in 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.

I tried to follow some tips from some topics in github, I also followed the documentation to use invalidNotify , but without success.

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:

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:

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

 $("#grid").jsGrid({ height:"auto", width:"100%", autoload:true, editing:true, paging:true, invalidMessage:"your error msg", ... }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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