【发布时间】:2014-08-31 12:40:13
【问题描述】:
我正在使用 API 数据填充 kendo--grid,但在一个字段上添加验证也会自动适用于其他所有字段。
这是 kendo-dataSource 中的架构:
schema: {
model: {
id : "id",
fields: {
id: { editable: false, type: 'number'},
name: { editable: true, type : "string" },
unique_url: { editable: true , type: 'string'},
image_url : { editable: true, type : "string" },
title: {type : "string", validation: {
required: true,
validateTitle: function (input) {
console.log("I am inside validation",input.val());
if (input.val().length > 5) {
input.attr("data-validateTitle-msg", "Max length exceeded 5 characters only");
return false;
}
return true;
}
}
},
body: { editable: true, type : "string",validation: { max: 90, required: true, message : "Maximum characters should be 90"} },
adaccount_id: { editable: false, type: 'number'}
}
}
},
在这里,我添加了对标题字段的验证,但也对其他字段进行了调用。 我正在添加一张验证快照---
请帮我找出其中的错误。
【问题讨论】:
标签: validation kendo-ui kendo-grid kendo-dataviz