javascriptjsgrid

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);
                }

Solution

  • 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"
            }]
        });
    };