我有一个剑道 UI 网格。我有两列包含日期选择器。我想在进行内联编辑时比较每一行的这两列之间的日期。单击更新时,应触发验证。我不想使用编辑器模板。这是我要实现的代码。
fields: {
BusinessAreaDivisionMappingId: { type: "number", editable: false, nullable: false },
BatoDivisionMappingStatus: { type: "number", nullable: false, validation: { required: true } },
BusinessAreaHierarchyId: { type: "number", editable: false },
BusinessAreaCode: { type: "string", editable: false },
DivisionCode: { type: "string", editable: false },
ReferenceValue: { type: "string", validation: { required: true } },
StartDate: {
type: "date",
required: true,
validation: {
required: true,
dateComparisonValidation: function (element) {
alert('hi');
debugger;
var columnIndex = 0;
var grid = $("#bAPLMappingGrid").data("kendoGrid");
for (columnIndex; columnIndex < grid.columns.length; columnIndex++) {
if (grid.columns[columnIndex].field == "EndDate") {
break;
}
}
var StartDate = $(element).data("kendoDatePicker").value();
var EndDate = (new Date($(element).closest("tr").find("td:eq(" + columnIndex + ")").text()));
element.attr("data-dateComparisonValidation-msg", "Start Date Cannot be more than End Date");
if (StartDate && EndDate)
return (StartDate <= EndDate);
return true;
}
}
},
EndDate: { type: "date" },
IsDeleted: { type: "boolean", editable: false, nullable: true }