I have a specific situation with my kendo UI Grid, where I am working with two columns - StartDate and EndDate. During inline editing, it is essential for me to ensure that the StartDate is not greater than the EndDate. I have implemented custom validation logic for the StartDate Field, but I am encountering an issue where the variable StartDate is being assigned a null value.
model: {
id: "BusinessAreaDivisionMappingId",
fields: {
BusinessAreaDivisionMappingId: { type: "number", editable: false, nullable: false },
StartDate: {
from: "BusinessAreaDivisionMappingEntity.StartDate", type: "date",
validation:
{
required: true,
dateComparisonValidation: function (input) {
debugger;
if (input && (input.attr("name") == "StartDate"|| input.attr("name") == "EndDate")) {
input.attr("data-dateComparisonValidation-msg", "Start Date cannot be more than End Date");
var startDate = input.closest(".k-edit-form-container").find("[name='StartDate']").data("kendoDatePicker");
var endDate = input.closest(".k-edit-form-container").find("[name='EndDate']").data("kendoDatePicker");
if (Date(startDate) > Date(endDate)) {
return false;
}
}
return true;
}
}
},
EndDate: { from: "BusinessAreaDivisionMappingEntity.EndDate", type: "date" }
}
}