Hi,
I have implemented a custom validation on the kendo grid. Ex: The column name is "DemandUnit" and value is "kVA"/"kW" or blank. The problem is if I change the value "kVA" to "kVAd" the validation message is showing but if I remove the "d" i.e. from "kVAd" to "kVA" the validation message not go away. I know kendo grid uses "MVVM" model but how I can force to apply validation always.
Here with code,
(function ($, kendo) {
$.extend(true, kendo.ui.validator, {
rules: { // custom rules
demandunitvalidation: function (input, params) {
if (input.is("[name='DemandUnit']") && input.val() != "") {
input.attr("data-demandunitvalidation-msg", "Demand unit must be kVA/kW or blank.");
return /^(kVA|kW)$/.test(input.val())
}
return true;
},
},
messages: { //custom rules messages
demandunitvalidation: function (input) {
// return the message text
return input.attr("data-val-demandunitvalidation");
}
}
});
})(jQuery, kendo);
Any help will be appreicated.
Regards,
Ujjwal