I have a business requirement that I don't know how to quite handle using the grid. I have set up inline batch editing on a grid for a customer. One of the requirements is to do client side business logic to validate the data before allowing the Save Changes functionality to work.
My grid is set up something like this
ColA ColB ColC ColD
10 0 0 0
The requirement is that if any of those 4 columns has a value, all the columns must have a non-zero value. I'm not sure how to access the ids/values of ColB, ColC, ColD so that I can do the comparison in the javascript. When I took a look using firebug, each of those fields had a guid identifier (screenshot below).
The code I am playing around with is as follows
//register custom validation rules
(function ($, kendo) {
$.extend(true, kendo.ui.validator, {
rules: { // custom rules
productnamevalidation: function (input, params) {
if (input.is("[name='operating_hrs']") && input.val() != "") {
input.attr("data-productnamevalidation-msg", "Product Name should start with capital letter");
if (input.val() != 24)
{
var input1 = $('input[data-bind="value:hrsepwr_hrs"]');
var input2 = input1.val();
alert(input2);
//alert($('#station_id').val());
return false;
}
//return /^[A-Z]/.test(input.val());
}
return true;
}
},
messages: { //custom rules messages
productnamevalidation: function (input) {
// return the message text
return input.attr("data-val-productnamevalidation");
}
}
});
})(jQuery, kendo);