Я определил пользовательское сообщение об ошибке для редактирования встроенной сетки, которое отлично работает на некоторых элементах, но не на всех. На обычном элементе, таком как текст, отображается пользовательское сообщение об ошибке, но в раскрывающемся списке «CertificateTypeId» я получаю сообщение об ошибке по умолчанию: «CertificateTypeId is require»
Код схемы, в котором я определяю пользовательскую проверку:
fields: {
CertificateTypeId: { type: "string", validation: { required: { message: 'Custom message' } } },
LastName: { type: "string", validation: { required: { message: 'Custom message' } } },
}
Код создания выпадающего меню, вызов функции из раздела определения столбца:
// Define the column section
var arrColums = [
{ field: "CertificateTypeId", title: "Some title", filterable: false, width: 150, headerAttributes: { style: "white-space: normal" }, editor: createDropDownEditor, template: "#=setDescription(CertificateTypeId,'CertificateTypes')#" },
{ field: "LastName", title: "Some title", filterable: false, width: 170, headerAttributes: { style: "white-space: normal" } }
]
function createDropDownEditor(container, options) {
var collectionName = "";
var dataTextField = "Description";
var dataValueField = "Id";
$('<input required name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
optionLabel: "Choose",
dataTextField: dataTextField,
dataValueField: dataValueField,
dataSource: {
type: "odata",
data: collection
},
filter: "contains",
});
$("<span class='k-invalid-msg' data-required-msg='שדה חובה' data-for='" + options.field + "'></span>").appendTo(container);
}