Hi Luis,Thanks for contacting Syncfusion’s support.We understood from your query, you need to add a validation rule dynamically for a particular column and we can achieve this requirement by using columns method of Grid control. Please refer to the below api reference link.And hence could you please provide the following details?1. Which scenario you need to add validation for a particular column?2. Do you need to add a validation rule for a column when initially render the Grid?3. Please provide clear details of your requirement.Regards,Saravanan A.
$(function () {
var str;
$.validator.addMethod("customvalidation", function (value, element, params) {
var fCellval = $(element.closest("td")).prev().find("input").val();
var sCellval = element.value;
if((fCellval != "" && sCellval != ""))
return true;
return false;
}, function(params, element) {
var val = $(element.closest("td")).prev().find("input").val();
var val1 = element.value;
//Change the message dynamically
if (val != "" && val1 == "")
str = "Customer ID is required";
else if(val == "" && val1 != "")
str = "First Cell value is required";
else
str = "Order ID and Customer ID is required";
return str;
});
$("#Grid").ejGrid({
columns: [
. . . { field: "CustomerID", headerText: 'Customer ID', width: 90, validationRules: { customvalidation: true } },
. . .
]
});
}); |