Checking a Kendo-Grid Column Field

I am working on filling the kendo grid with API data, but when adding a check for one field, it automatically works for all other fields.

Here is the diagram inside kendo-dataSource:

schema: {
                   model: {
                       id : "id",
                       fields: {
                           id: { editable: false, type: 'number'},
                           name: { editable: true, type : "string" },
                           unique_url: { editable: true , type: 'string'},
                           image_url : { editable: true, type : "string" },
                           title: {type : "string", validation: {
                                                required: true,
                                                validateTitle: function (input) {
                                                    console.log("I am inside validation",input.val());
                                                    if (input.val().length > 5) {
                                                       input.attr("data-validateTitle-msg", "Max length exceeded 5 characters only");
                                                       return false;
                                                    }    

                                                    return true;
                                                }
                                            }
                                            },
                           body: { editable: true, type : "string",validation: { max: 90, required: true, message : "Maximum characters should be 90"} },
                           adaccount_id: { editable: false, type: 'number'}
                       }
                   }
                },  

Here I added confirmation for the header field, but getting it causes other fields as well. I add one check snapshot - enter image description here

Please help me find errors in it.

+4
source share
2 answers

, Kendo Grid. , title, , .

validateTitle , . - :

if (input.is("[name='title']") && input.val().length > 5) {
    input.attr("data-validateTitle-msg", "Max length exceeded 5 characters only");
    return false;
}

, - Telerik, , . demo , .

+4

enter image description here

,  [ (ErrorMessage = "CountryCode " )]        CountryCode       {           ;           ;       }

+1

Source: https://habr.com/ru/post/1547873/


All Articles